/* 刻意不引入网络字体（Google Fonts 等）。
 * CSS 的 @import 是渲染阻塞的：浏览器必须把外部样式表下载解析完才允许绘制。
 * fonts.googleapis.com 在大陆访问质量差，请求挂住会让首屏白屏卡住直到超时，
 * 对演示是致命问题。中文产品用系统字体效果也更好：
 *   Mac/iOS → PingFang SC，Windows → 微软雅黑，安卓 → 思源黑/Noto Sans CJK
 * 都是即时可用、零请求、离线正常。 */
:root {
  --ink: #202720;
  --ink-soft: #465047;
  --muted: #899187;
  --paper: #f7f8f4;
  --paper-deep: #eef1ea;
  --white: #ffffff;
  --line: #e3e8df;
  --sage: #d9e3d1;
  --sage-deep: #9eb297;
  --forest: #344b3c;
  --coral: #e68061;
  --coral-soft: #f9e2d9;
  --yellow: #f2c976;
  --yellow-soft: #fdf1d5;
  --shadow: 0 22px 70px rgba(49, 65, 53, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(230, 128, 97, 0.3);
  outline-offset: 3px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  max-width: 1500px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: 0 0 245px;
  flex-direction: column;
  min-height: 100vh;
  padding: 34px 24px 25px;
  background: #eff2eb;
  border-right: 1px solid var(--line);
}

.brand,
.profile-card,
.topbar-actions,
.capture-footer,
.today-panel-header,
.filter-row,
.section-heading,
.memory-search,
.suggestion-row,
.mini-insights,
.capture-card-top {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  color: var(--white);
  background: var(--forest);
  border-radius: 13px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(52, 75, 60, 0.18);
}

.brand-name {
  color: var(--forest);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.primary-nav {
  display: grid;
  gap: 6px;
  margin-top: 75px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px 14px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border-radius: 13px;
  transition: 180ms ease;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.52);
}

.nav-item.active {
  color: var(--forest);
  background: var(--white);
  box-shadow: 0 8px 22px rgba(66, 84, 69, 0.06);
  font-weight: 700;
}

.nav-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  font-size: 19px;
  font-weight: 400;
}

.sidebar-note {
  position: relative;
  margin-top: auto;
  margin-bottom: 22px;
  padding: 17px 17px 16px 19px;
  overflow: hidden;
  color: var(--forest);
  background: var(--sage);
  border-radius: 19px;
}

.sidebar-note p {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  font-weight: 600;
}

.note-spark {
  position: absolute;
  right: 14px;
  bottom: -6px;
  color: rgba(52, 75, 60, 0.17);
  font-size: 61px;
  line-height: 1;
}

.profile-card {
  gap: 10px;
  padding: 11px 9px;
  border-top: 1px solid rgba(137, 145, 135, 0.2);
}

.avatar,
.avatar-button {
  display: grid;
  place-items: center;
  color: var(--forest);
  background: var(--yellow);
  border-radius: 50%;
  font-weight: 800;
}

.avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

.profile-copy {
  display: grid;
  flex: 1;
  gap: 2px;
}

.profile-copy strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.profile-copy span {
  color: var(--muted);
  font-size: 10px;
}

.more-button {
  padding: 5px;
  color: var(--muted);
  background: transparent;
  letter-spacing: 2px;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 34px clamp(25px, 5vw, 75px) 65px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 42px;
}

.topbar-kicker,
.section-eyebrow,
.mini-label,
.tiny-date,
.demo-badge,
.timeline-stat span {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.topbar-kicker {
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 10px;
}

.topbar h1 {
  margin: 0;
  color: var(--forest);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.topbar-actions {
  gap: 13px;
}

.demo-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #7eb081;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(126, 176, 129, 0.15);
}

.ai-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  color: var(--forest);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.ai-badge[hidden] {
  display: none;
}

.ai-badge[data-state="offline"] {
  color: var(--muted);
}

.ai-badge[data-state="offline"] .status-dot {
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(230, 128, 97, 0.15);
}

/* 标记这条记录由 AI 整理，便于和用户原始内容区分 */
.ai-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  color: var(--forest);
  font-size: 9px;
  background: var(--sage);
  border-radius: 999px;
  vertical-align: middle;
}

.ai-tag.is-pending {
  color: var(--muted);
  background: var(--paper-deep);
}

.ai-tag.is-failed {
  color: var(--coral);
  background: var(--coral-soft);
}

.avatar-button {
  width: 35px;
  height: 35px;
  font-size: 12px;
}

.view {
  display: none;
  animation: fade-in 350ms ease both;
}

.view.active {
  display: block;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.record-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.83fr);
  gap: 23px;
}

.capture-card,
.today-panel {
  position: relative;
  min-height: 475px;
  padding: clamp(24px, 4vw, 41px);
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.capture-card {
  background: var(--white);
  box-shadow: var(--shadow);
}

.capture-card-top {
  position: relative;
  align-items: flex-start;
  justify-content: space-between;
}

.section-eyebrow {
  color: var(--sage-deep);
  font-size: 9px;
  font-weight: 500;
}

.capture-card h2,
.page-intro h2 {
  margin: 11px 0 7px;
  color: var(--forest);
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.055em;
}

.capture-intro,
.page-intro p {
  max-width: 475px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.soft-orb {
  position: absolute;
  top: -85px;
  right: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  opacity: 0.45;
  filter: blur(1px);
}

.orb-coral {
  background: radial-gradient(circle at 45% 45%, #ffd9ca, rgba(255, 217, 202, 0));
}

.record-stage {
  display: grid;
  justify-items: center;
  margin: 34px 0 26px;
}

.record-button {
  position: relative;
  display: grid;
  width: 123px;
  height: 123px;
  place-items: center;
  color: var(--white);
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 18px 35px rgba(230, 128, 97, 0.23);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.record-button:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 22px 42px rgba(230, 128, 97, 0.3);
}

.record-button.is-recording {
  background: var(--forest);
  box-shadow: 0 0 0 12px rgba(52, 75, 60, 0.11), 0 18px 35px rgba(52, 75, 60, 0.22);
}

.record-button-halo {
  position: absolute;
  width: 153px;
  height: 153px;
  border: 1px solid rgba(230, 128, 97, 0.19);
  border-radius: 50%;
}

.record-button.is-recording .record-button-halo {
  border-color: rgba(52, 75, 60, 0.2);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.3;
  }
}

.record-button-core {
  margin-top: -10px;
  font-size: 25px;
  line-height: 1;
  transform: scaleX(0.75);
}

.record-button-label {
  position: absolute;
  bottom: 24px;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.record-status {
  margin-top: 15px;
  color: var(--muted);
  font-size: 11px;
}

/* 松开即存开关：刻意做小，不抢主按钮的视觉重量 */
.auto-save-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 11px;
  padding: 4px 9px 4px 7px;
  color: var(--muted);
  font-size: 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: 180ms ease;
}

.auto-save-toggle:hover {
  color: var(--forest);
  background: rgba(255, 255, 255, 0.7);
}

.auto-save-toggle[aria-pressed="true"] {
  color: var(--forest);
}

.auto-save-dot {
  width: 5px;
  height: 5px;
  background: var(--sage-deep);
  border-radius: 50%;
  transition: 180ms ease;
}

.auto-save-toggle[aria-pressed="true"] .auto-save-dot {
  background: var(--forest);
  box-shadow: 0 0 0 3px rgba(52, 75, 60, 0.12);
}

.quick-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.tool-button,
.filter-chip,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-radius: 999px;
  transition: 180ms ease;
}

.tool-button {
  padding: 10px 12px;
  font-size: 11px;
}

.tool-button:hover,
.filter-chip:hover,
.secondary-button:hover {
  background: var(--sage);
}

.tool-button.subtle {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
}

.tool-icon {
  color: var(--sage-deep);
  font-size: 17px;
}

.transcript-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.transcript-input {
  display: block;
  width: 100%;
  padding: 14px 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: 13px;
  outline: none;
  resize: vertical;
  font-size: 12px;
  line-height: 1.7;
  transition: 180ms ease;
}

.transcript-input:focus {
  background: var(--white);
  border-color: var(--sage-deep);
}

.capture-footer {
  justify-content: space-between;
  gap: 15px;
  margin-top: 15px;
}

.privacy-hint {
  color: var(--muted);
  font-size: 10px;
}

.export-button {
  padding: 4px 8px;
  color: var(--muted);
  font-size: 10px;
}

.export-button:hover {
  color: var(--forest);
}

.primary-button,
.memory-search button {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px 12px 17px;
  color: var(--white);
  background: var(--forest);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  transition: 180ms ease;
}

.primary-button:hover,
.memory-search button:hover {
  background: #47634f;
  transform: translateY(-1px);
}

.primary-button span,
.memory-search button span,
.secondary-button span,
.text-button span {
  font-size: 16px;
  line-height: 0.8;
}

.today-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--forest);
  background: var(--sage);
}

.today-panel::after {
  position: absolute;
  right: -64px;
  bottom: -74px;
  width: 220px;
  height: 220px;
  content: "";
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
}

.today-panel-header {
  justify-content: space-between;
}

.tiny-date {
  color: rgba(52, 75, 60, 0.5);
  font-size: 10px;
}

.today-metric {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  margin-top: 50px;
}

.metric-number {
  color: var(--forest);
  font-size: 83px;
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.1em;
}

.metric-copy {
  display: grid;
  gap: 7px;
  max-width: 125px;
  padding-bottom: 4px;
}

.metric-copy strong {
  font-size: 13px;
  line-height: 1.4;
}

.metric-copy span {
  color: rgba(52, 75, 60, 0.66);
  font-size: 10px;
  line-height: 1.55;
}

.progress-track {
  height: 5px;
  margin-top: 22px;
  overflow: hidden;
  background: rgba(52, 75, 60, 0.12);
  border-radius: 99px;
}

.progress-track span {
  display: block;
  width: 44%;
  height: 100%;
  background: var(--forest);
  border-radius: inherit;
  transition: width 500ms ease;
}

.today-quote {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 70px;
}

.quote-mark {
  display: block;
  height: 23px;
  color: rgba(52, 75, 60, 0.32);
  font-family: Georgia, serif;
  font-size: 50px;
  line-height: 0.9;
}

.today-quote p {
  max-width: 205px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: -0.03em;
}

.mini-insights {
  position: relative;
  z-index: 1;
  gap: 18px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid rgba(52, 75, 60, 0.14);
}

.mini-insights > div {
  display: grid;
  gap: 6px;
}

.mini-label {
  color: rgba(52, 75, 60, 0.55);
  font-size: 8px;
}

.mini-insights strong {
  font-size: 11px;
}

.content-section {
  margin-top: 50px;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 17px;
}

.section-heading h3 {
  margin: 6px 0 0;
  color: var(--forest);
  font-size: 21px;
  letter-spacing: -0.045em;
}

.text-button {
  padding: 8px 0 8px 10px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.text-button:hover {
  color: var(--forest);
  background: transparent;
}

.entry-list {
  display: grid;
  gap: 10px;
}

.entry-card {
  display: grid;
  grid-template-columns: 49px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid rgba(227, 232, 223, 0.72);
  border-radius: 16px;
  transition: 180ms ease;
}

.entry-card:hover {
  border-color: var(--sage-deep);
  box-shadow: 0 10px 25px rgba(52, 75, 60, 0.06);
  transform: translateY(-2px);
}

.entry-thumb {
  display: grid;
  width: 49px;
  height: 49px;
  place-items: center;
  overflow: hidden;
  background: var(--coral-soft);
  border-radius: 13px;
  font-size: 22px;
}

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

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
}

.entry-meta .mood {
  color: var(--coral);
  font-weight: 700;
}

.entry-main h4 {
  overflow: hidden;
  margin: 0 0 4px;
  color: var(--forest);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-main p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.entry-arrow {
  color: var(--sage-deep);
  font-size: 20px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.page-intro h2 {
  font-size: clamp(34px, 4vw, 50px);
}

.timeline-stat {
  display: grid;
  justify-items: end;
  gap: 6px;
  padding-bottom: 7px;
  color: var(--muted);
}

.timeline-stat strong {
  color: var(--forest);
  font-size: 35px;
  line-height: 0.8;
}

.timeline-stat span {
  font-size: 9px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 42px 0 25px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-count {
  margin-left: 3px;
  color: var(--sage-deep);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 9px;
}

.filter-chip.active .filter-count {
  color: var(--forest);
}

.filter-chip {
  padding: 9px 13px;
  color: var(--muted);
  font-size: 10px;
}

.filter-chip.active {
  color: var(--forest);
  background: var(--sage);
  font-weight: 700;
}

.filter-spacer {
  flex: 1;
}

.secondary-button {
  padding: 9px 13px;
  color: var(--forest);
  font-size: 10px;
  background: transparent;
  border: 1px solid var(--line);
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 16px;
  padding-left: 20px;
}

.timeline-list::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 4px;
  width: 1px;
  content: "";
  background: var(--line);
}

/* 导出入口放在时间线末尾：与"问问这些回忆"分开，不抢筛选行位置 */
.timeline-footer {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.timeline-footer .export-button {
  padding: 10px 18px;
  color: var(--muted);
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.timeline-footer .export-button:hover {
  color: var(--forest);
  background: var(--paper-deep);
  border-color: var(--sage-deep);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 17px;
}

.timeline-item::before {
  position: absolute;
  top: 18px;
  left: -19px;
  width: 8px;
  height: 8px;
  content: "";
  background: var(--coral);
  border: 3px solid var(--paper);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--coral);
}

.timeline-date {
  padding-top: 15px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.timeline-date strong {
  display: block;
  color: var(--forest);
  font-size: 12px;
}

.timeline-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 16px;
  padding: 17px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.timeline-card h4 {
  margin: 5px 0 8px;
  color: var(--forest);
  font-size: 15px;
}

.timeline-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.timeline-location {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--coral);
  font-size: 10px;
}

.timeline-photo {
  min-height: 106px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--yellow-soft), var(--coral-soft));
  border-radius: 13px;
}

.timeline-photo-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 106px;
  place-items: center;
  color: rgba(52, 75, 60, 0.42);
  font-size: 30px;
}

/* ---------- 回顾页 ---------- */

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 11px;
}

.mini-tag {
  padding: 3px 8px;
  color: var(--muted);
  font-size: 9px;
  background: var(--paper-deep);
  border-radius: 999px;
}

.empty-state {
  padding: 26px 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  background: var(--paper-deep);
  border-radius: 16px;
}

.review-list {
  display: grid;
  gap: 16px;
}

.review-card {
  padding: 17px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.review-card.is-weekly {
  background: linear-gradient(135deg, var(--yellow-soft), var(--white) 62%);
  border-color: var(--sage);
}

.review-card.is-pending {
  background: var(--paper-deep);
  border-style: dashed;
}

.review-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.review-type {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  color: var(--forest);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--sage);
  border-radius: 999px;
}

.review-card.is-weekly .review-type {
  color: var(--ink);
  background: var(--yellow);
}

.review-range {
  color: var(--muted);
  font-size: 10px;
}

.review-card h4 {
  margin: 0 0 7px;
  color: var(--forest);
  font-size: 16px;
}

.review-summary {
  margin: 0 0 11px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
}

.review-highlights {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  padding-left: 11px;
  border-left: 2px solid var(--sage-deep);
}

.review-highlight {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.review-card .review-toggle {
  padding: 7px 11px;
  font-size: 10px;
}

.review-card .review-toggle span {
  transition: transform 180ms ease;
}

.review-card .review-toggle.is-open span {
  transform: rotate(180deg);
}

.review-fragments {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.review-fragment {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 11px;
}

.review-fragment-time {
  padding-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 9px;
}

.review-fragment strong {
  display: block;
  margin-bottom: 3px;
  color: var(--forest);
  font-size: 12px;
}

.review-fragment p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.review-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  color: var(--ink-soft);
  font-size: 11px;
  background: var(--coral-soft);
  border-radius: 14px;
}

.memory-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 225px;
  padding: 36px 43px;
  overflow: hidden;
  color: var(--forest);
  background: var(--yellow-soft);
  border-radius: var(--radius-lg);
}

.memory-hero::after {
  position: absolute;
  right: 75px;
  bottom: -120px;
  width: 280px;
  height: 280px;
  content: "";
  border: 1px solid rgba(191, 143, 53, 0.15);
  border-radius: 50%;
  box-shadow: 0 0 0 30px rgba(191, 143, 53, 0.04), 0 0 0 60px rgba(191, 143, 53, 0.035);
}

.memory-hero-copy {
  position: relative;
  z-index: 1;
}

.memory-hero h2 {
  margin: 12px 0 9px;
  font-size: clamp(32px, 4vw, 49px);
  line-height: 1.12;
  letter-spacing: -0.065em;
}

.memory-hero h2 em {
  color: var(--coral);
  font-style: normal;
}

.memory-hero p {
  max-width: 405px;
  margin: 0;
  color: rgba(52, 75, 60, 0.64);
  font-size: 12px;
  line-height: 1.75;
}

.memory-hero-symbol {
  position: relative;
  z-index: 1;
  padding-right: 22px;
  color: rgba(230, 128, 97, 0.65);
  font-family: Georgia, serif;
  font-size: 116px;
  line-height: 1;
  transform: rotate(-16deg);
}

.memory-search {
  gap: 12px;
  margin-top: 23px;
  padding: 8px 8px 8px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 12px 30px rgba(52, 75, 60, 0.06);
}

.search-icon {
  color: var(--coral);
  font-size: 21px;
}

.memory-search input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  font-size: 12px;
}

.memory-search button {
  padding: 12px 14px 12px 16px;
}

/* 常规搜索作为次要按钮，弱化处理避免抢“问一下”的主操作 */
.memory-search #memoryPlainSearch {
  padding: 10px 13px;
  color: var(--muted);
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--line);
}

.memory-search #memoryPlainSearch:hover {
  color: var(--forest);
  background: var(--paper-deep);
}

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

.suggestion-row {
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.suggestion-chip {
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
}

.suggestion-chip:hover {
  color: var(--forest);
  border-color: var(--sage-deep);
}

.memory-result {
  min-height: 125px;
  margin-top: 24px;
}

.result-placeholder {
  display: grid;
  min-height: 125px;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
  border: 1px dashed var(--line);
  border-radius: 18px;
  text-align: center;
}

.placeholder-icon {
  margin-bottom: 3px;
  color: var(--coral);
  font-size: 24px;
}

.result-placeholder p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.result-placeholder span:last-child {
  font-size: 10px;
}

.answer-card {
  padding: 21px 23px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 13px 32px rgba(52, 75, 60, 0.05);
}

.answer-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--sage-deep);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.answer-kicker::before {
  width: 6px;
  height: 6px;
  content: "";
  background: var(--coral);
  border-radius: 50%;
}

.answer-card h3 {
  max-width: 700px;
  margin: 12px 0 8px;
  color: var(--forest);
  font-size: 18px;
  line-height: 1.55;
  letter-spacing: -0.035em;
}

.answer-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.answer-records {
  display: grid;
  gap: 8px;
  margin-top: 17px;
}

.answer-record {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  background: var(--paper);
  border-radius: 12px;
}

.answer-record-icon {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  background: var(--coral-soft);
  border-radius: 9px;
}

.answer-record-copy {
  display: grid;
  gap: 2px;
}

.answer-record-copy strong {
  color: var(--forest);
  font-size: 11px;
}

.answer-record-copy span {
  color: var(--muted);
  font-size: 10px;
}

.is-clickable {
  cursor: pointer;
}

.entry-card.is-clickable:hover,
.answer-record.is-clickable:hover {
  border-color: var(--sage-deep);
}

.timeline-item.is-clickable:hover .timeline-card {
  border-color: var(--sage-deep);
}

.answer-record-edit {
  margin-left: auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.memory-cards-section {
  margin-top: 39px;
}

.nudge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.nudge-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  border-radius: 16px;
}

.nudge-green {
  color: var(--forest);
  background: var(--sage);
}

.nudge-peach {
  color: #835444;
  background: var(--coral-soft);
}

.nudge-icon {
  display: grid;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  place-items: center;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  font-size: 16px;
}

.nudge-card div {
  display: grid;
  gap: 7px;
}

.nudge-card span:not(.nudge-icon) {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.62;
}

.nudge-card strong {
  font-size: 12px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 10;
  max-width: min(320px, calc(100vw - 40px));
  padding: 12px 15px;
  color: var(--white);
  background: var(--forest);
  border-radius: 11px;
  box-shadow: 0 15px 35px rgba(32, 39, 32, 0.2);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 220ms ease;
}

/* iPhone 全屏运行时避开底部 Home 指示条与左右安全区 */
.toast {
  right: calc(25px + env(safe-area-inset-right, 0px));
  bottom: calc(25px + env(safe-area-inset-bottom, 0px));
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- 条目编辑弹窗 ---------- */

.entry-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

/* 全屏运行时避开刘海与底部指示条 */
.entry-modal {
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
}

.entry-modal[hidden] {
  display: none;
}

.entry-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 39, 32, 0.42);
}

.entry-modal-panel {
  position: flex;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(86vh, 780px);
  overflow: hidden;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.entry-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.entry-modal-head h3 {
  margin: 4px 0 0;
  color: var(--forest);
  font-size: 19px;
}

.entry-modal-close {
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  background: var(--paper-deep);
  border-radius: 9px;
}

.entry-modal-close:hover {
  color: var(--forest);
  background: var(--sage);
}

.entry-modal-body {
  display: grid;
  gap: 5px;
  padding: 16px 24px 22px;
  overflow-y: auto;
}

.entry-modal-status {
  margin-bottom: 6px;
  padding: 9px 12px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.6;
  background: var(--yellow-soft);
  border-radius: 10px;
}

.entry-modal-status:empty {
  display: none;
}

.field-label {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 10px;
  color: var(--forest);
  font-size: 11px;
  font-weight: 700;
}

.field-note {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.entry-edit-input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.6;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 11px;
  resize: vertical;
}

.entry-edit-input:focus {
  background: var(--white);
  border-color: var(--sage-deep);
  outline: none;
}

.entry-edit-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.entry-modal-meta {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.entry-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
}

.entry-modal-foot-actions {
  display: flex;
  gap: 9px;
}

.entry-delete-button {
  color: var(--coral);
  border-color: var(--coral-soft);
}

.entry-delete-button:hover {
  color: var(--white);
  background: var(--coral);
  border-color: var(--coral);
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .sidebar {
    flex-basis: 205px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .main-content {
    padding-right: 28px;
    padding-left: 28px;
  }

  .record-layout {
    grid-template-columns: 1fr;
  }

  .today-panel {
    min-height: 300px;
  }

  .today-metric {
    margin-top: 28px;
  }

  .today-quote {
    padding-top: 35px;
  }
}

@media (max-width: 700px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    display: block;
    min-height: auto;
    padding: 17px 17px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  /* 全屏运行时避开 iPhone 刘海与状态栏 */
  .sidebar {
    padding-top: calc(17px + env(safe-area-inset-top, 0px));
    padding-left: calc(17px + env(safe-area-inset-left, 0px));
    padding-right: calc(17px + env(safe-area-inset-right, 0px));
  }

  .brand {
    padding: 0;
  }

  .primary-nav {
    display: flex;
    gap: 4px;
    margin-top: 16px;
  }

  .nav-item {
    justify-content: center;
    gap: 5px;
    padding: 10px 8px;
    font-size: 11px;
  }

  .nav-icon {
    display: none;
  }

  .sidebar-note,
  .profile-card {
    display: none;
  }

  .main-content {
    padding: 25px 17px 44px;
  }

  .topbar {
    margin-bottom: 27px;
  }

  .topbar h1 {
    font-size: 25px;
  }

  .demo-badge {
    display: none;
  }

  .capture-card,
  .today-panel {
    padding: 24px 19px;
    border-radius: 20px;
  }

  .capture-card {
    min-height: 0;
  }

  .capture-card h2 {
    font-size: 29px;
  }

  .record-button {
    width: 112px;
    height: 112px;
  }

  .record-button-halo {
    width: 138px;
    height: 138px;
  }

  .capture-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
    justify-content: center;
  }

  .today-panel {
    min-height: 310px;
  }

  .page-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 20px;
  }

  .timeline-stat {
    justify-items: start;
  }

  .filter-row {
    flex-wrap: wrap;
    margin-top: 27px;
  }

  .filter-spacer {
    display: none;
  }

  .secondary-button {
    width: 100%;
    justify-content: center;
    margin-top: 5px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .timeline-date {
    padding-top: 0;
  }

  .timeline-card {
    grid-template-columns: 1fr;
  }

  .timeline-photo {
    order: -1;
    min-height: 120px;
  }

  .memory-hero {
    min-height: 280px;
    padding: 27px 21px;
  }

  .memory-hero-symbol {
    position: absolute;
    right: 4px;
    bottom: -8px;
    font-size: 94px;
  }

  .memory-search {
    align-items: stretch;
    flex-wrap: wrap;
    padding: 12px;
  }

  .memory-search input {
    flex-basis: calc(100% - 42px);
  }

  .memory-search button {
    justify-content: center;
    width: 100%;
  }

  .nudge-grid {
    grid-template-columns: 1fr;
  }

  .entry-card {
    grid-template-columns: 43px minmax(0, 1fr);
    gap: 11px;
    padding: 12px;
  }

  .entry-thumb {
    width: 43px;
    height: 43px;
  }

  .entry-arrow {
    display: none;
  }

  /* 手机端把过小的点击区域放大到拇指友好尺寸。
     桌面上保持小尺寸以免抢视觉重量，只在小屏覆写。 */
  .auto-save-toggle {
    margin-top: 13px;
    padding: 9px 13px 9px 11px;
    font-size: 10px;
  }

  .auto-save-dot {
    width: 7px;
    height: 7px;
  }

  .suggestion-chip {
    padding: 10px 13px;
    font-size: 11px;
  }

  .filter-chip {
    padding: 11px 14px;
    font-size: 11px;
  }

  .review-toggle {
    padding: 10px 12px;
    font-size: 11px;
  }

  .entry-modal-close {
    padding: 10px 13px;
    font-size: 14px;
  }

  .text-button {
    padding: 10px 12px;
  }

  /* 底部留出安全区，避免内容被 Home 指示条压住 */
  .main-content {
    padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px));
  }
}

/* ---------- 首次打开引导弹窗 ---------- */

.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(20px + env(safe-area-inset-left, 0px));
  padding-right: calc(20px + env(safe-area-inset-right, 0px));
}

.intro-modal[hidden] {
  display: none;
}

.intro-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 39, 32, 0.5);
  animation: intro-fade 0.24s ease both;
}

.intro-modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(600px, 100%);
  max-height: min(88vh, 860px);
  overflow: hidden;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: intro-rise 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

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

@keyframes intro-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
}

.intro-modal-head {
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--paper) 0%, var(--white) 100%);
}

.intro-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.intro-brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  color: var(--paper);
  background: var(--forest);
  border-radius: 14px;
  font-size: 22px;
  font-weight: 700;
}

.intro-modal-head h3 {
  margin: 4px 0 0;
  color: var(--forest);
  font-size: 19px;
  line-height: 1.35;
}

.intro-modal-body {
  display: grid;
  gap: 4px;
  padding: 18px 26px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.intro-lede {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

.intro-lede b {
  color: var(--forest);
}

/* ---- 每一步:左示意图,右文字 ---- */

.intro-step {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px dashed var(--line);
}

.intro-step:first-of-type {
  border-top: 0;
}

.intro-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 10px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.intro-copy strong {
  display: block;
  margin-bottom: 5px;
  color: var(--forest);
  font-size: 14px;
}

.intro-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.intro-copy b {
  color: var(--forest);
  font-weight: 600;
}

/* ---- 示意图里的微型元件 ---- */

.iv-record {
  width: 30px;
  height: 30px;
  flex: none;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 0 0 5px var(--coral-soft);
}

.iv-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 26px;
}

.iv-wave i {
  width: 3px;
  background: var(--sage-deep);
  border-radius: 2px;
}

.iv-wave i:nth-child(1) { height: 9px; }
.iv-wave i:nth-child(2) { height: 17px; }
.iv-wave i:nth-child(3) { height: 24px; }
.iv-wave i:nth-child(4) { height: 13px; }
.iv-wave i:nth-child(5) { height: 7px; }

.iv-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 74px;
  padding: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.iv-card.is-clickable {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-soft);
}

.iv-card.is-edit {
  width: 58px;
  border-style: dashed;
  border-color: var(--sage-deep);
}

.iv-card.is-review {
  width: 46px;
  height: 40px;
}

.iv-card.is-review:last-child {
  margin-left: -26px;
  transform: rotate(4deg);
}

.iv-card.is-review:first-child {
  transform: rotate(-4deg);
}

.iv-line {
  height: 5px;
  background: var(--sage);
  border-radius: 3px;
}

.iv-line.w70 { width: 70%; }
.iv-line.w60 { width: 60%; }
.iv-line.w50 { width: 50%; }
.iv-line.w45 { width: 45%; }
.iv-line.w40 { width: 40%; }
.iv-line.w30 { width: 30%; }

.iv-tag {
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 6px;
  color: var(--forest);
  background: var(--sage);
  border-radius: 5px;
  font-size: 8px;
  font-weight: 600;
}

.iv-arrow {
  color: var(--coral);
  font-size: 13px;
}

.iv-pen {
  color: var(--sage-deep);
  font-size: 11px;
}

.iv-search {
  display: block;
  width: 100%;
  padding: 6px 8px;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.iv-answer {
  display: block;
  width: 86%;
  padding: 6px 8px;
  color: var(--forest);
  background: var(--yellow-soft);
  border-radius: 8px;
  font-size: 9px;
  line-height: 1.5;
}

.intro-visual-stack {
  flex-direction: column;
  gap: 5px;
}

/* ---- 细节提示 ---- */

.intro-tips {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.intro-tips-title {
  margin-bottom: 8px;
  color: var(--forest);
  font-size: 13px;
  font-weight: 700;
}

.intro-tips ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.intro-tips li {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.65;
}

.intro-tips b {
  color: var(--forest);
}

.iv-dots {
  display: inline-block;
  padding: 0 5px;
  color: var(--forest);
  background: var(--sage);
  border-radius: 5px;
  font-weight: 700;
}

/* ---- 底部 ---- */

.intro-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 26px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.intro-foot-note {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  .intro-step {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .intro-visual {
    min-height: 62px;
  }

  .intro-modal-head,
  .intro-modal-body,
  .intro-modal-foot {
    padding-left: 18px;
    padding-right: 18px;
  }
}
