/* 人生年轮 · 样式（原生 CSS，无构建、无框架）
   设计令牌与 study / money 同一套，只把主色换成暖黄 #F59E0B。 */

:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1c2130;
  --muted: #8a91a3;
  --line: #e8eaf1;
  --accent: #f59e0b;
  --accent-soft: #fff5e2;
  --accent-deep: #b45309;
  --danger: #e5484d;
  --ok: #22c55e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 30px -18px rgba(16, 24, 40, 0.35);
  --font: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--accent-deep);
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.boot {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

/* ---------- 骨架 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 246, 250, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  box-shadow: 0 6px 16px -8px rgba(245, 158, 11, 0.9);
}

.brand-name {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.brand-tag {
  font-size: 12px;
  color: var(--muted);
  margin-left: 2px;
}

.brand-user {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 8px 14px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
  white-space: nowrap;
}

.tab.active {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 18px 120px;
}

.page-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 2px 0 14px;
}

.page-title {
  font-size: 20px;
  font-weight: 750;
}

.page-head .muted {
  margin-left: auto;
  font-size: 12px;
}

/* ---------- 卡片 / 通用 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 234, 241, 0.9);
  padding: 16px;
}

.card + .card {
  margin-top: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .sub {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 34px 16px;
  font-size: 14px;
  line-height: 1.8;
}

.empty strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
}

/* ---------- 统计 ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 234, 241, 0.9);
  padding: 12px 10px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.stat-value span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* ---------- 搜索 ---------- */
.search {
  position: relative;
  margin-bottom: 12px;
}

.search input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0 40px 0 38px;
  outline: none;
  box-shadow: var(--shadow);
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.search .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
}

.search .clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  display: none;
  place-items: center;
  font-size: 15px;
}

.search.has-value .clear {
  display: grid;
}

.search-hint {
  font-size: 12px;
  color: var(--muted);
  margin: -6px 0 12px 2px;
}

/* ---------- 布局：主列 + 桌面侧栏 ---------- */
.layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main-col {
  min-width: 0;
}

.side-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  order: -1;
}

.side-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 234, 241, 0.9);
  padding: 14px;
}

.side-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (min-width: 1024px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 268px;
    align-items: start;
    gap: 18px;
  }

  .side-col {
    order: 0;
    position: sticky;
    top: 78px;
  }
}

/* 侧栏里的筛选列表 */
.filter-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}

.filter-item:hover {
  background: #f7f7fb;
}

.filter-item.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}

.filter-item .filter-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1023px) {
  .filter-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .filter-list::-webkit-scrollbar {
    display: none;
  }

  .filter-item {
    flex: 0 0 auto;
    width: auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    background: #fff;
  }

  .filter-item .filter-count {
    margin-left: 2px;
  }

  .legend-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
  }

  .legend-list::-webkit-scrollbar {
    display: none;
  }

  .legend-list .filter-item {
    flex: 0 0 auto;
  }

  .overview-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.overview-item {
  background: #fbfbfd;
  border-radius: 10px;
  padding: 8px 10px;
}

.overview-item .label {
  font-size: 11px;
  color: var(--muted);
}

.overview-item .value {
  font-size: 17px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.overview-item .value small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 3px;
}

/* ---------- 那年今日 ---------- */
.otd {
  background: linear-gradient(135deg, #fff9ee, #ffffff);
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.otd-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 750;
  color: var(--accent-deep);
  margin-bottom: 10px;
}

.otd-head .otd-date {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.otd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 6px;
  border-radius: 10px;
  text-align: left;
  border-bottom: 1px dashed rgba(245, 158, 11, 0.28);
}

.otd-item:last-child {
  border-bottom: none;
}

.otd-item:hover {
  background: rgba(245, 158, 11, 0.07);
}

.otd-years {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
}

.otd-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.otd-date-text {
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}

/* ---------- 时间轴：年 / 月 分组 ---------- */
.year-group {
  margin-bottom: 14px;
}

.year-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 14px;
  background: var(--card);
  border: 1px solid rgba(232, 234, 241, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
}

.year-head .chevron,
.month-head .chevron {
  color: var(--muted);
  font-size: 10px;
  transition: transform 0.18s;
  width: 10px;
  flex: 0 0 auto;
}

.year-group.open > .year-head .chevron,
.month-group.open > .month-head .chevron {
  transform: rotate(90deg);
}

.year-label {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.year-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.year-body {
  display: none;
  padding-top: 12px;
}

.year-group.open > .year-body {
  display: block;
}

.month-group {
  padding-left: 10px;
  border-left: 2px solid var(--line);
  margin-bottom: 10px;
}

.month-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 2px 4px 6px;
  text-align: left;
}

.month-label {
  font-size: 14px;
  font-weight: 700;
}

.month-label.unknown {
  color: var(--muted);
}

.month-count {
  font-size: 12px;
  color: var(--muted);
}

.month-body {
  display: none;
  padding: 0 0 4px 2px;
}

.month-group.open > .month-body {
  display: block;
}

/* ---------- 事件卡片：重要度决定大小 ---------- */
.ev-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ev-card {
  /* 中等 = 标准尺寸；大/小只覆盖这几个变量，不在 JS 里写死任何尺寸 */
  --ev-pad: 13px;
  --ev-title-size: 15px;
  --ev-title-weight: 650;
  --ev-icon-size: 34px;
  --ev-icon-font: 18px;
  --ev-opacity: 1;
  --ev-gap: 12px;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--ev-gap);
  padding: var(--ev-pad);
  background: var(--card);
  border: 1px solid rgba(232, 234, 241, 0.95);
  border-radius: 14px;
  box-shadow: var(--shadow);
  opacity: var(--ev-opacity);
  text-align: left;
  width: 100%;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.ev-card:active {
  transform: scale(0.995);
}

.ev-card:hover {
  border-color: rgba(245, 158, 11, 0.55);
}

.ev-card.imp-2 {
  --ev-pad: 13px;
}

.ev-card.imp-3 {
  --ev-pad: 18px;
  --ev-title-size: 19px;
  --ev-title-weight: 750;
  --ev-icon-size: 48px;
  --ev-icon-font: 26px;
  --ev-gap: 14px;
  border-left: 4px solid var(--accent);
}

.ev-card.imp-1 {
  --ev-pad: 9px 11px;
  --ev-title-size: 13.5px;
  --ev-title-weight: 500;
  --ev-icon-size: 27px;
  --ev-icon-font: 14px;
  --ev-opacity: 0.87;
  --ev-gap: 10px;
}

.ev-icon {
  flex: 0 0 auto;
  width: var(--ev-icon-size);
  height: var(--ev-icon-size);
  border-radius: 12px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: var(--ev-icon-font);
  line-height: 1;
}

.ev-body {
  flex: 1;
  min-width: 0;
}

.ev-title {
  font-size: var(--ev-title-size);
  font-weight: var(--ev-title-weight);
  line-height: 1.4;
  word-break: break-word;
}

.ev-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.ev-meta .ev-emotion {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0 8px;
  font-weight: 600;
}

.ev-meta .ev-place {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-persons {
  display: flex;
  align-items: center;
  margin-top: 7px;
}

.avatar {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  background: var(--muted);
  overflow: hidden;
}

.ev-persons .avatar + .avatar {
  margin-left: -7px;
  box-shadow: 0 0 0 2px #fff;
}

.avatar-more {
  flex: 0 0 auto;
  margin-left: 4px;
  font-size: 11px;
  color: var(--muted);
}

.ev-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.ev-photo-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.ev-lock {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-deep);
  background: rgba(245, 246, 250, 0.74);
  backdrop-filter: blur(3px);
}

.ev-card.locked {
  cursor: pointer;
}

/* ---------- 搜索空态 ---------- */
.search-empty {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(232, 234, 241, 0.9);
  box-shadow: var(--shadow);
}

/* ---------- 按钮 ---------- */
.btn {
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  background: #f1f2f7;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: filter 0.15s, background 0.15s;
}

.btn:active {
  filter: brightness(0.96);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px -12px var(--accent);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.block {
  width: 100%;
}

.btn.small {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn.danger {
  background: #fdecec;
  color: var(--danger);
}

.link-btn {
  font-size: 13px;
  color: var(--accent-deep);
  padding: 4px 8px;
  border-radius: 8px;
}

.link-btn.danger {
  color: var(--danger);
}

.link-btn:hover {
  background: #f1f2f7;
}

.icon-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 15px;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: #f1f2f7;
  color: var(--danger);
}

/* ---------- 悬浮按钮 ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  height: 50px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 14px 30px -12px rgba(245, 158, 11, 0.9);
  z-index: 30;
}

.fab:active {
  transform: translateY(1px);
}

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 35, 0.42);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.16s ease-out;
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slideup 0.2s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.sheet-head {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.sheet-head h3 {
  margin: 0;
  font-size: 17px;
}

.sheet-head .close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 18px;
  display: grid;
  place-items: center;
}

.field {
  margin-bottom: 16px;
}

.field > label,
.field > .label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}

.field input[type="text"],
.field input[type="date"],
.field input[type="month"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  height: 44px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  padding: 0 12px;
  outline: none;
}

.field textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, #fff 70%, rgba(255, 255, 255, 0));
  padding-top: 10px;
}

.sheet-actions .btn {
  flex: 1;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.6;
}

/* ---------- 分段选择（精度 / 重要程度） ---------- */
.seg {
  display: flex;
  gap: 6px;
}

.seg-btn {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.seg-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14);
}

.date-row {
  margin-top: 8px;
}

/* ---------- 九宫格类型 ---------- */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.type-btn {
  padding: 8px 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.type-btn .type-icon {
  font-size: 20px;
  line-height: 1.1;
}

.type-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14);
}

/* ---------- 心情 5 档 + 情绪词 ---------- */
.emo-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.emo-btn {
  padding: 7px 2px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.25;
}

.emo-btn .emoji {
  font-size: 21px;
  line-height: 1.15;
}

.emo-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
}

.emo-btn.active .emoji {
  transform: scale(1.08);
}

.word-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.word-chip {
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  color: var(--text);
}

.word-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 14px -10px rgba(245, 158, 11, 1);
}

.word-chip.add {
  border-style: dashed;
  color: var(--accent-deep);
  font-weight: 600;
}

.word-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
}

.word-input-row input {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  padding: 0 10px;
  outline: none;
  font-size: 13px;
}

.word-input-row input:focus {
  border-color: var(--accent);
  background: #fff;
}

/* ---------- 人物多选 / 地点 ---------- */
.person-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 148px;
  overflow-y: auto;
  padding: 2px;
}

.person-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

.person-pick.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}

.person-pick .avatar {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.new-person-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.new-person-row input {
  flex: 1;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fbfbfd;
  padding: 0 10px;
  outline: none;
  font-size: 13px;
}

.new-person-row input:focus {
  border-color: var(--accent);
  background: #fff;
}

/* ---------- 照片 ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #f1f2f7;
  border: 1px solid var(--line);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb .photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.photo-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px dashed rgba(245, 158, 11, 0.6);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.photo-add input {
  display: none;
}

/* ---------- 私密开关 ---------- */
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #e2e5ee;
  transition: background 0.15s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.switch-row input:checked + .switch {
  background: var(--accent);
}

.switch-row input:checked + .switch::after {
  transform: translateX(20px);
}

/* ---------- 列表行（人物 / 地点 / 设置） ---------- */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid rgba(232, 234, 241, 0.9);
  box-shadow: var(--shadow);
  text-align: left;
  margin-bottom: 10px;
}

.list-row:hover {
  border-color: rgba(245, 158, 11, 0.5);
}

.list-row .avatar {
  width: 40px;
  height: 40px;
  font-size: 15px;
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-title {
  font-size: 15px;
  font-weight: 650;
  word-break: break-word;
}

.list-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.list-actions {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}

.relation-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 700;
}

/* ---------- 详情页 ---------- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 8px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.detail-hero {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(232, 234, 241, 0.9);
  box-shadow: var(--shadow);
  padding: 20px;
  border-left: 5px solid var(--accent);
}

.detail-hero.imp-1 {
  opacity: 0.95;
  border-left-width: 3px;
}

.detail-hero.imp-3 {
  padding: 24px;
}

.detail-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 28px;
  margin-bottom: 12px;
}

.detail-hero.imp-3 .detail-icon {
  width: 62px;
  height: 62px;
  font-size: 34px;
}

.detail-title {
  font-size: 22px;
  font-weight: 750;
  margin: 0 0 4px;
  word-break: break-word;
  padding-right: 96px;
}

.detail-hero.imp-3 .detail-title {
  font-size: 26px;
}

.detail-date {
  font-size: 14px;
  color: var(--muted);
}

.detail-actions {
  position: absolute;
  top: 16px;
  right: 14px;
  display: flex;
  gap: 2px;
}

.detail-section {
  margin-top: 14px;
}

.detail-section .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.emotion-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.emotion-seg {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #edeff5;
}

.emotion-seg.on {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.emotion-now {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 650;
}

.emotion-now .emoji {
  font-size: 22px;
}

.emotion-word {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 15px;
  font-weight: 700;
}

.detail-desc {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 15px;
  word-break: break-word;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px 0 5px;
  border-radius: 999px;
  background: #fbfbfd;
  border: 1px solid var(--line);
  font-size: 13px;
}

.detail-stamp {
  font-size: 12px;
  color: var(--muted);
  margin-top: 18px;
  text-align: center;
}

.locked-panel {
  text-align: center;
  padding: 40px 20px;
}

.locked-panel .lock-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.locked-panel .lock-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.photo-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.photo-wall a {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #f1f2f7;
  border: 1px solid var(--line);
}

.photo-wall img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
}

.login-card h1 {
  font-size: 19px;
  margin: 0 0 4px;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.login-card .field {
  text-align: left;
}

.login-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 8px;
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translate(-50%, 12px);
  background: rgba(28, 33, 48, 0.94);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: 80vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: rgba(196, 43, 47, 0.96);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes slideup {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
}

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  .container {
    padding: 14px 14px 120px;
  }

  .topbar-inner {
    padding: 10px 14px 0;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand-tag {
    display: none;
  }

  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .emo-btn {
    padding: 6px 0;
  }

  .emo-btn .emoji {
    font-size: 19px;
  }

  .emo-btn span:last-child {
    font-size: 9px;
  }

  .sheet {
    border-radius: 20px 20px 0 0;
  }

  .fab {
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .detail-title {
    padding-right: 0;
  }

  .detail-actions {
    position: static;
    margin-top: 12px;
  }

  .detail-hero {
    padding: 16px;
  }

  .photo-grid,
  .photo-wall {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 641px) {
  .sheet-mask {
    align-items: center;
  }

  .sheet {
    border-radius: 20px;
    max-height: 84vh;
  }
}


/* ---------- 重做时补：情绪词行、移动端侧栏 ---------- */
.word-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.word-item:last-child {
  border-bottom: none;
}

.word-text {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .legend-card,
  .overview-card {
    display: none;
  }
}
