/* 氧气 · 视觉规范
   米白 #F7F5F0 / 浅灰 #E8E8E6 / 淡青 #DCE8E6 / 墨色 #2C2C2C / 克制珊瑚 #C97B6A
   衬线字体,移动端优先,桌面居中窄栏。安静、克制、像纸。 */

:root {
  --paper: #F7F5F0;
  --mist: #E8E8E6;
  --cyan: #DCE8E6;
  --ink: #2C2C2C;
  --ink-soft: #6B6B66;
  --heart: #C97B6A;
  --serif: "Songti SC", "SimSun", "Noto Serif SC", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.8;
}

/* 移动端:取消双击缩放延迟与点击灰色高亮 */
button, a, input, textarea, select { touch-action: manipulation; }

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 24px;
}

.hidden { display: none !important; }

/* 顶栏(顶部安全区:从主屏幕启动时不顶到状态栏) */
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: calc(22px + env(safe-area-inset-top)) 0 10px;
}
.brand { font-size: 20px; letter-spacing: 6px; }
.nickname { font-size: 12px; color: var(--ink-soft); }

/* 顶部链接(回到氧气 / 我的后台) */
.top-right { display: flex; align-items: baseline; gap: 14px; }
.back-link {
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.back-link:hover { color: var(--ink); }
button.back-link.as-btn {
  background: none;
  border: none;
  font-family: var(--serif);
  cursor: pointer;
  padding: 0;
}

main { flex: 1; padding-bottom: 84px; }

/* 视图切换:轻淡入 */
.view { animation: fadein .45s ease; }
@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* 今日 */
.date { margin-top: 48px; font-size: 13px; color: var(--ink-soft); letter-spacing: 2px; }
.theme {
  margin-top: 14px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.6;
}
.theme.small { font-size: 20px; margin-bottom: 18px; }
.whisper { margin-top: 18px; font-size: 14px; color: var(--ink-soft); }
.whisper.center { text-align: center; }
.label { margin-top: 32px; font-size: 12px; color: var(--ink-soft); letter-spacing: 3px; }

.actions { margin-top: 40px; display: flex; gap: 14px; }
.actions.center { justify-content: center; }

/* 按钮 */
.btn {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--mist);
  border-radius: 999px;
  padding: 10px 26px;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease;
}
.btn:hover { background: var(--mist); }
.btn.primary { background: var(--cyan); border-color: var(--cyan); }
.btn.primary:hover { background: #cfe0dd; }
.btn:disabled { opacity: .5; cursor: default; }

.linklike {
  display: block;
  margin: 26px auto 0;
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* 书写室 */
textarea {
  width: 100%;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 2;
  color: var(--ink);
  background: #FDFCF9;
  border: 1px solid var(--mist);
  border-radius: 10px;
  padding: 18px;
  resize: vertical;
  outline: none;
  transition: border-color .25s ease;
}
textarea:focus { border-color: var(--cyan); }
textarea::placeholder { color: #B4B2AB; }

.write-bar {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.counter { font-size: 12px; color: var(--ink-soft); }

/* 去遇见 · 信封与信 */
.envelope { perspective: 800px; margin-top: 28px; }
.letter {
  background: #FDFCF9;
  border: 1px solid var(--mist);
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 6px 24px rgba(44, 44, 44, .05);
  transform-origin: top center;
}
.envelope.opening .letter { animation: unfold .7s ease; }
@keyframes unfold {
  0%   { opacity: 0; transform: rotateX(-62deg) translateY(-10px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
.letter-theme { font-size: 12px; color: var(--ink-soft); letter-spacing: 1px; }
.letter-content {
  margin-top: 14px;
  font-size: 17px;
  line-height: 2.1;
  white-space: pre-wrap;
  word-break: break-word;
}
.letter-author { margin-top: 20px; font-size: 13px; color: var(--ink-soft); text-align: right; }

.letter-actions {
  margin-top: 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
}

/* 心 */
.heart-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 8px 12px;
}
.heart-icon { font-size: 22px; line-height: 1; transition: color .3s ease; }
.heart-btn.hearted { color: var(--heart); }
.heart-btn.hearted .heart-icon { color: var(--heart); }
.heart-btn.pulse .heart-icon { animation: heartbeat .5s ease; }
@keyframes heartbeat {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  70%  { transform: scale(.92); }
  100% { transform: scale(1); }
}

/* 我的信 */
.mine-card {
  margin-top: 18px;
  background: #FDFCF9;
  border: 1px solid var(--mist);
  border-radius: 12px;
  padding: 20px;
}
.mine-theme { font-size: 12px; color: var(--ink-soft); }
.mine-content {
  margin-top: 8px;
  font-size: 15px;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
}
.mine-meta {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
}
.mine-echo { color: var(--heart); }

/* 底部导航 */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 640px;
  display: flex;
  background: rgba(247, 245, 240, .92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--mist);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1;
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-soft);
  padding: 8px 0;
  cursor: pointer;
  transition: color .25s ease;
}
.tab.active { color: var(--ink); font-weight: 600; }

/* 页脚 · 版本号 */
.site-footer {
  margin-top: 48px;
  text-align: center;
  font-size: 12px;
  color: #B4B2AB;
  letter-spacing: 2px;
}

/* 轻提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  max-width: 82vw;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  line-height: 1.7;
  border-radius: 10px;
  padding: 12px 20px;
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: 30;
}
.toast.show { opacity: .94; }

/* 危机关怀 */
.care-mask {
  position: fixed;
  inset: 0;
  background: rgba(44, 44, 44, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 40;
}
.care-card {
  max-width: 420px;
  background: var(--paper);
  border-radius: 14px;
  padding: 30px 26px;
  text-align: center;
  animation: fadein .4s ease;
}
.care-text { font-size: 15px; line-height: 2.1; }
.care-hotline { margin: 18px 0 22px; font-size: 15px; }
.care-hotline a { color: var(--heart); text-decoration: none; font-weight: 600; }

@media (min-width: 700px) {
  .theme { font-size: 32px; }
  .date { margin-top: 72px; }
}

/* 窄屏手机:收紧留白,防止按钮/顶栏溢出 */
@media (max-width: 420px) {
  .app { padding: 0 18px; }
  .brand { letter-spacing: 4px; }
  .top { flex-wrap: wrap; row-gap: 4px; }
  .top-right { gap: 10px; }
  .date { margin-top: 32px; }
  .theme { font-size: 24px; }
  .theme.small { font-size: 18px; }
  .actions { flex-wrap: wrap; margin-top: 32px; }
  .btn { padding: 10px 22px; }
  .letter { padding: 22px 18px; }
  .letter-actions { gap: 14px; }
  .mine-card { padding: 16px; }
  .tab { font-size: 13px; }
}