/* 首页、添加回忆、碎碎念列表、启动页：精简版布局 */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* — 首页顶部轮播：从大半屏缩到一半左右 — */
/* 固定高度：每张卡片一样大，不随文字多少变化；超出的文字用省略号收起 */
#appContent .stream-swiper,
#appContent .stream-slide { height: 280px; min-height: 0; }
#appContent .stream-slide { padding: 22px 22px 40px; }
#appContent .stream-slide h2 { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: clamp(1.3rem, 3.4vw, 2rem); }
#appContent .stream-slide p { margin: 4px 0 0; }
#appContent .stream-slide-meta { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#appContent .stream-slide-text { -webkit-line-clamp: 2; }
#appContent .stream-slide-copy:has(> audio, > button) .stream-slide-text { -webkit-line-clamp: 1; }
@media (max-width: 860px) {
  #appContent .stream-swiper,
  #appContent .stream-slide { height: 250px; }
  #appContent .stream-slide { padding: 20px 18px 40px; }
}

/* — 首页「今天要做」 — */
.home-plan-preview-grid:has(.home-today-row, .home-today-empty) { display: grid; grid-template-columns: 1fr; gap: 0; }
.home-today-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.home-today-row:first-child { border-top: 0; }
.home-today-text {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--text);
  text-align: left;
}
.home-today-text strong { font-size: .98rem; overflow-wrap: anywhere; }
.home-today-text small { color: var(--muted); font-size: .76rem; font-weight: 500; }
.home-today-row.is-overdue small { color: #b14d5b; }
.home-today-empty { margin: 4px 0; color: var(--muted); }
.home-next-travel {
  justify-self: start;
  margin-top: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

/* — 首页财务卡片：其余数字折叠 — */
.finance-home-more > summary { margin-top: 10px; color: var(--muted); font-size: .88rem; font-weight: 700; cursor: pointer; }
.finance-home-more[open] { display: grid; gap: 12px; }

/* — 添加回忆：大号添加照片按钮，原生文件框隐藏 — */
.media-pick {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 18px 14px;
  border: 2px dashed var(--line);
  border-radius: 18px;
  background: var(--surface);
  cursor: pointer;
  text-align: center;
}
.media-pick input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.media-pick input[type="file"]:disabled { cursor: not-allowed; }
.media-pick:has(input:disabled) { opacity: .55; }
.media-pick-button { color: var(--accent-strong, var(--accent)); font-size: 1.05rem; font-weight: 800; }
.media-pick-hint { color: var(--muted); font-size: .8rem; }
.media-pick-video { padding: 12px 14px; }
.media-pick-video .media-pick-button { font-size: .95rem; }
.media-pick:focus-within { border-color: var(--accent); }
details.location-picker > summary { color: var(--accent-strong, var(--accent)); font-weight: 700; cursor: pointer; }
details.location-picker[open] { display: grid; gap: 10px; }
#momentScreen #backToContent { width: auto; justify-self: start; min-height: 38px; padding: 6px 14px; font-size: .86rem; }

/* — 碎碎念 / 回忆列表：整张卡片可点 — */
.unified-post-card { cursor: pointer; }
.unified-post-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.unified-post-card h3 { margin: 0 0 4px; overflow-wrap: anywhere; }
.unified-post-card.is-whisper h3 { font-size: 1.02rem; font-weight: 600; line-height: 1.6; }
.unified-post-meta { margin: 0; color: var(--muted); font-size: .8rem; }
.unified-post-text { margin: 6px 0 0; color: var(--text); }
.memory-search-drawer .timeline-sort { display: flex; gap: 8px; margin: 4px 0 8px; }

/* — 启动页：次要按钮收进「更多」 — */
.home-more { position: relative; }
.home-more > summary { list-style: none; cursor: pointer; }
#homeScreen .home-more > summary.light-button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 24px; font-size: 1rem; }
.home-more > summary::-webkit-details-marker { display: none; }
.home-more-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 20;
  display: grid;
  gap: 8px;
  min-width: 180px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(20, 31, 40, .18);
  transform: translateX(-50%);
}
.home-more-menu .auth-user { text-align: center; color: var(--muted); font-size: .85rem; }

/* — 倒数日页：标题一行放下，去掉程序聚焦留下的黑框 — */
main h1[tabindex="-1"]:focus { outline: none; }
#anniversaryScreen .topbar { position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; }
#anniversaryScreen .topbar h1 { flex: 1 1 auto; }
#anniversaryScreen .topbar .anniversary-add { margin-left: 0; }
#anniversaryScreen #anniversaryTopbarMore { flex: 0 0 auto; width: auto; }

/* — 生理期弹窗：显示疼不疼/累不累/心情/备注，记录可整条点开 — */
.anniversary-dialog .cycle-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.anniversary-dialog label:has(#cycleNote) { display: grid; gap: 6px; }
@media (max-width: 620px) { .anniversary-dialog .cycle-status-grid { grid-template-columns: 1fr 1fr; } }
button.cycle-record-item { display: block; width: 100%; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.anniversary-dialog #cyclePreferencesForm { display: grid; gap: 10px; }
.anniversary-dialog #cyclePreferencesForm .today-kicker { display: none; }

/* — 首页关怀提醒 — */
.home-care-card {
  grid-column: 1 / -1;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 16px;
  background: #fde8ee;
  color: #9b3a55;
  font-weight: 700;
  text-align: left;
}
:root[data-theme="dark"] .home-care-card { background: #4a2a35; color: #ffd6e2; }

/* — 碎碎念：写的表单默认收起；回应变成一行表情 — */
.whispers-layout:not(.is-composing) #whisperForm { display: none; }
.whispers-layout.is-composing #whisperComposeToggle { display: none; }
.whisper-compose-toggle { width: 100%; min-height: 48px; margin-bottom: 14px; grid-column: 1 / -1; }
#whisperForm .section-heading { display: flex; align-items: center; justify-content: space-between; }
.whisper-compose-close { min-height: 36px; padding: 6px 14px; }
label:has(> #whisperAuthor[readonly]) { display: none; }
.whisper-response-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.whisper-response-actions button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.25rem;
}
.whisper-response-actions button > span:not(.whisper-response-emoji) { display: none; }
.whisper-emoji-more > summary { display: inline-flex; align-items: center; height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 21px; font-size: .9rem; cursor: pointer; list-style: none; }
.whisper-emoji-more > summary::-webkit-details-marker { display: none; }
.whisper-emoji-more[open] { flex-basis: 100%; }
.whisper-emoji-panel { max-height: 260px; margin-top: 8px; padding: 6px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--paper, var(--surface)); }
.whisper-emoji-group { margin: 6px 4px 4px; color: var(--muted); font-size: .76rem; font-weight: 700; }
.whisper-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; }
.whisper-response-actions .whisper-emoji-grid button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; border: 0; background: transparent; box-shadow: none; font-size: 1.4rem; }
.whisper-response-actions .whisper-emoji-grid button.active { background: var(--accent-soft); }
.whisper-response-form { display: grid; gap: 8px; }
.whisper-reply-box { display: flex; align-items: flex-end; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper, var(--surface)); }
.whisper-reply-box:focus-within { border-color: var(--accent); }
.whisper-response-form .whisper-reply-box textarea { flex: 1; min-width: 0; min-height: 38px; max-height: 160px; padding: 8px; border: 0; background: transparent; box-shadow: none; resize: none; field-sizing: content; }
.whisper-reply-box button[type="submit"] { flex: 0 0 auto; min-height: 36px; padding: 0 14px; border: 0; background: var(--accent); color: #fff; font-size: .86rem; white-space: nowrap; }

/* — 回忆详情：标题一行；补写收起；回应按钮不显示 0 — */
#detailScreen .topbar { position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; }
#detailScreen .topbar > div { flex: 1 1 auto; min-width: 0; }
#detailScreen #detailTopbarMore { flex: 0 0 auto; width: auto; }
.moment-reactions button span:empty { display: none; }
.moment-contribution-fold > summary {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 16px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--accent-strong, var(--accent));
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.moment-contribution-fold > summary::-webkit-details-marker { display: none; }
.moment-contribution-fold[open] > summary { margin-bottom: 10px; }
.moment-contributions:empty { display: none; }

/* — 旅行行程详情 — */
#travelDetailScreen header { display: flex; align-items: center; gap: 8px; position: relative; }
#travelDetailScreen header h2 { flex: 1 1 auto; min-width: 0; margin: 0; overflow-wrap: anywhere; }
#travelDetailScreen .travel-back, #travelDetailScreen .travel-more-toggle { width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 1.4rem; }
#travelDetailScreen .travel-more-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  display: grid; padding: 8px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: 0 16px 40px rgba(20, 31, 40, .16);
}
#travelDetailScreen .travel-more-menu[hidden] { display: none; }
#travelDetailScreen .travel-overview-line { margin: 4px 0; }
#travelDetailScreen .travel-itinerary-card.is-editable { cursor: pointer; }
#travelDetailScreen .travel-itinerary-card.is-editable:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#travelDetailScreen .travel-link-button { min-height: 0; padding: 4px 6px; border: 0; background: none; box-shadow: none; color: var(--muted); text-decoration: underline; font-weight: 500; }

/* — 碎碎念页：标题一行 — */
#whispersScreen .topbar { position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; }
#whispersScreen .topbar h1 { flex: 1 1 auto; min-width: 0; }
#whispersScreen #whispersTopbarMore { flex: 0 0 auto; width: auto; }
