/* 时光邮局 · 浅色主题 */
:root {
  --bg: #faf6ef;
  --bg-soft: #f2eadd;
  --card: #fffdf9;
  --ink: #3b332b;
  --ink-soft: #8a7c6b;
  --line: #e9dfcf;
  --brand: #b0764a;
  --brand-deep: #8f5a34;
  --gold: #c9a05e;
  --danger: #bf5648;
  --radius: 14px;
  --shadow: 0 10px 34px rgba(120, 90, 60, 0.10);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(217, 160, 91, 0.14), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(201, 160, 94, 0.10), transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- 按钮 ---------- */
.btn {
  border: 0; border-radius: 10px; padding: 11px 20px;
  font-size: 15px; letter-spacing: 1px;
  transition: background .2s, border-color .2s, color .2s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff8f0; }
.btn-primary:hover { background: var(--brand-deep); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--brand); border-color: var(--brand); }
.btn-block { width: 100%; margin-top: 22px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ---------- 登录 / 注册 ---------- */
.auth-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 40px 16px; gap: 22px;
}
.auth-card {
  width: min(400px, 100%);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow);
  padding: 38px 34px 30px;
  animation: rise .45s ease both;
}
.brand { text-align: center; margin-bottom: 26px; }
.brand-logo { width: 62px; height: 62px; }
.brand-name { font-size: 26px; letter-spacing: 8px; text-indent: 8px; margin-top: 12px; }
.brand-tag { margin-top: 8px; font-size: 13px; color: var(--ink-soft); letter-spacing: 3px; }

.tabs { display: flex; gap: 4px; background: var(--bg-soft); border-radius: 10px; padding: 4px; margin-bottom: 4px; }
.tab { flex: 1; border: 0; background: transparent; padding: 8px 0; font-size: 14px; color: var(--ink-soft); border-radius: 8px; transition: background .2s, color .2s; }
.tab.is-active { background: var(--card); color: var(--brand-deep); box-shadow: 0 2px 8px rgba(120, 90, 60, 0.12); font-weight: 600; }

.field { margin-top: 16px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 14px; font-size: 14px; color: var(--ink);
  background: #fffefb; border: 1px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(176, 118, 74, 0.14); }
.field-error, .form-error { color: var(--danger); font-size: 12.5px; margin-top: 7px; line-height: 1.6; }
.form-error { margin-top: 14px; }
.form-hint { font-size: 12px; color: var(--ink-soft); margin-top: 8px; }

.auth-switch { text-align: center; font-size: 13px; color: var(--ink-soft); margin-top: 20px; }
.auth-switch a { color: var(--brand); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.page-foot { font-size: 12px; letter-spacing: 4px; color: var(--ink-soft); opacity: .75; }

/* ---------- 使用步骤幻灯片 ---------- */
.ob-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.ob-card {
  width: min(540px, 100%); text-align: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow);
  padding: 52px 44px 34px;
  animation: rise .4s ease both;
}
.slide-icon {
  width: 84px; height: 84px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg-soft); color: var(--brand);
}
.slide-icon svg { width: 44px; height: 44px; }
.slide-step { margin-top: 20px; font-size: 12px; letter-spacing: 3px; color: var(--gold); }
.slide-title { margin-top: 10px; font-size: 24px; letter-spacing: 4px; }
.slide-desc { margin: 16px auto 0; max-width: 380px; font-size: 14.5px; line-height: 2; color: var(--ink-soft); }

.final-icon { width: 168px; margin: 0 auto; animation: floaty 5s ease-in-out infinite; }
.final-icon svg { width: 100%; height: auto; display: block; }
.final-copy {
  margin-top: 28px; font-family: var(--serif);
  font-size: 16.5px; line-height: 2.3; letter-spacing: 1px; color: var(--ink);
}

.ob-dots { display: flex; justify-content: center; gap: 8px; margin-top: 36px; }
.dot { width: 7px; height: 7px; border-radius: 999px; background: var(--line); transition: all .25s; }
.dot.is-active { width: 20px; background: var(--brand); }

.ob-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; }
.ob-actions .btn-primary { min-width: 150px; }
.ob-actions span { min-width: 90px; }
.ob-skip { margin-top: 18px; background: none; border: 0; font-size: 13px; color: var(--ink-soft); }
.ob-skip:hover { color: var(--brand); }

/* ---------- 主页 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 253, 249, 0.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 980px; margin: 0 auto; padding: 13px 24px; display: flex; align-items: center; justify-content: space-between; }
.topbar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 18px; letter-spacing: 3px; color: var(--ink); text-decoration: none; }
.topbar-brand a { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.topbar-brand img { width: 30px; height: 30px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 14px; color: var(--brand-deep); background: var(--bg-soft); border-radius: 999px; padding: 6px 14px; text-decoration: none; transition: background .2s, color .2s; }
.user-chip:hover { background: rgba(176, 118, 74, 0.14); color: var(--brand); }

.home-main { max-width: 980px; margin: 0 auto; padding: 48px 24px 60px; animation: rise .45s ease both; }
.hero h2 { font-size: 30px; letter-spacing: 2px; }
.hero-date { margin-top: 10px; color: var(--ink-soft); font-size: 14px; letter-spacing: 1px; }

/* ---------- 到达提醒条 ---------- */
.notify-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 28px; padding: 14px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  font-size: 13px; color: var(--ink-soft);
}
.notify-strip.is-on { border-color: rgba(109, 138, 106, 0.4); background: rgba(109, 138, 106, 0.06); color: #6d8a6a; }
.notify-strip.is-muted { opacity: .8; }
.notify-strip .btn { flex: 0 0 auto; }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 26px; }
.feature-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 22px; }
.feature-card.is-disabled { opacity: .8; }
.feature-card.is-link { cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s; }
.feature-card.is-link:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.fc-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
.fc-icon svg { width: 28px; height: 28px; }
.feature-card h3 { margin-top: 16px; font-size: 17px; letter-spacing: 2px; }
.feature-card p { margin-top: 10px; font-size: 13px; line-height: 1.9; color: var(--ink-soft); }
.fc-badge {
  display: inline-block; margin-top: 16px; font-size: 12px; letter-spacing: 1px;
  color: var(--gold); background: rgba(201, 160, 94, 0.12); border-radius: 999px; padding: 4px 12px;
}
.home-note { margin-top: 40px; text-align: center; font-size: 13px; color: var(--ink-soft); letter-spacing: 2px; }

/* ---------- 写一封信 ---------- */
.write-main { max-width: 820px; margin: 0 auto; padding: 34px 24px 60px; animation: rise .4s ease both; }
.write-head { margin-bottom: 26px; }
.back-link { font-size: 13px; color: var(--ink-soft); text-decoration: none; }
.back-link:hover { color: var(--brand); }
.write-head h2 { margin-top: 14px; font-size: 28px; letter-spacing: 4px; }
.write-sub { margin-top: 9px; font-size: 13.5px; color: var(--ink-soft); letter-spacing: .5px; }

.write-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px 32px 26px;
}
.write-field { margin-bottom: 24px; }
.write-field:last-of-type { margin-bottom: 0; }
.write-label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 9px; }
.write-label-row { display: flex; align-items: baseline; justify-content: space-between; }
.write-label-row .write-label { margin-bottom: 9px; }
.write-hint { margin-top: 8px; font-size: 12px; color: var(--ink-soft); opacity: .85; }

.paper-options { display: flex; gap: 10px; }
.paper-option {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px 8px 10px; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--ink-soft);
  transition: border-color .2s, color .2s, background .2s;
}
.paper-option input { position: absolute; opacity: 0; pointer-events: none; }
.paper-option.is-active { border-color: var(--brand); color: var(--brand-deep); background: rgba(176, 118, 74, 0.05); }
.paper-swatch {
  width: 26px; height: 32px; border-radius: 3px;
  background: linear-gradient(160deg, #fffdf8, #f2e9da);
  border: 1px solid var(--line);
  box-shadow: 1px 1px 0 #fff inset;
}

.time-row { display: flex; gap: 12px; flex-wrap: wrap; }
.time-row input {
  padding: 10px 12px; font-size: 14px; color: var(--ink);
  background: #fffefb; border: 1px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.time-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(176, 118, 74, 0.14); }
.time-row input[type="date"] { flex: 0 0 168px; }
.time-row input[type="time"] { flex: 0 0 130px; }

.char-count { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.char-count.is-full { color: var(--danger); }

.paper {
  border: 1px solid var(--line); border-radius: 12px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 35px, rgba(200, 180, 150, 0.22) 35px 36px),
    linear-gradient(160deg, #fffdf8, #faf3e7);
  padding: 20px 22px;
}
.paper textarea {
  display: block; width: 100%; min-height: 320px; resize: vertical;
  border: 0; outline: none; background: transparent;
  font-family: var(--serif); font-size: 15.5px; line-height: 36px;
  color: var(--ink); letter-spacing: .5px;
}
.paper textarea::placeholder { color: #b8a894; }

.write-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.save-tip { font-size: 12.5px; color: var(--gold); margin-right: auto; }

/* ---------- 二次确认弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(59, 51, 43, 0.32); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: min(420px, 100%);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 18px 50px rgba(80, 60, 40, 0.2);
  padding: 30px 30px 24px; animation: rise .28s ease both;
}
.modal-card h3 { font-size: 19px; letter-spacing: 2px; }
.modal-text { margin-top: 16px; font-size: 14px; line-height: 2; color: var(--ink-soft); }
.modal-text strong { color: var(--brand-deep); font-weight: 600; }
.modal-time { color: var(--ink); font-variant-numeric: tabular-nums; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 26px; }

/* ---------- 寄出成功 ---------- */
.success-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 44px 36px 32px; text-align: center;
}
.success-card .slide-icon { width: 72px; height: 72px; }
.success-title { margin-top: 20px; font-size: 24px; letter-spacing: 4px; }
.success-sub { margin-top: 12px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.9; }
.meta-list { margin: 28px auto 0; max-width: 380px; text-align: left; }
.meta-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.meta-row dt { color: var(--ink-soft); }
.meta-row dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.success-actions { display: flex; justify-content: center; gap: 10px; margin-top: 28px; flex-wrap: wrap; }

/* ---------- 我寄出的 ---------- */
.letter-item.is-static { cursor: default; }
.letter-item.is-static:hover { border-color: var(--line); box-shadow: none; transform: none; }
.letter-item.is-scheduled .letter-dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(201, 160, 94, 0.16); }
.letter-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.letter-status {
  font-size: 11.5px; color: var(--gold);
  background: rgba(201, 160, 94, 0.12); border-radius: 999px; padding: 2px 10px;
}
.letter-status.is-done { color: #6d8a6a; background: rgba(109, 138, 106, 0.12); }
.empty-card {
  background: var(--card); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 40px 24px; text-align: center;
  font-size: 14px; color: var(--ink-soft); line-height: 2;
}
.empty-card .btn { margin-top: 16px; }

/* ---------- 账号设置 ---------- */
.settings-main { max-width: 620px; margin: 0 auto; padding: 34px 24px 60px; animation: rise .4s ease both; }
.settings-card { padding: 26px 30px 24px; margin-bottom: 16px; }
.section-title { font-size: 16px; letter-spacing: 2px; color: var(--ink); margin-bottom: 6px; }
.settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 20px; }
.form-success { font-size: 12.5px; color: #6d8a6a; margin-right: auto; }

/* ---------- 启封信封 ---------- */
.envelope-main {
  max-width: 640px; margin: 0 auto; padding: 70px 24px 60px;
  display: flex; justify-content: center; animation: rise .45s ease both;
}
.envelope-stage { text-align: center; }
.env-body {
  position: relative;
  width: min(340px, 84vw); aspect-ratio: 1.52;
  perspective: 900px;
  cursor: pointer;
}
.env-back {
  position: absolute; inset: 0; border-radius: 8px;
  background: #e9dcc3;
  box-shadow: 0 14px 34px rgba(80, 60, 40, 0.16);
}
.env-letter {
  position: absolute; left: 50%; bottom: 8%;
  width: 78%; height: 84%;
  transform: translate(-50%, 0);
  background: #fffdf7;
  border: 1px solid rgba(176, 118, 74, 0.14);
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(80, 60, 40, 0.08);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14%;
  z-index: 2;
}
.env-letter span {
  font-family: var(--serif); font-size: 15px; letter-spacing: 8px;
  color: var(--brand-deep);
}
.env-front {
  position: absolute; inset: 0; border-radius: 8px;
  background: #f3e8d2;
  clip-path: polygon(0 0, 50% 46%, 100% 0, 100% 100%, 0 100%);
  z-index: 3;
}
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 52%;
  background: #ead9ba;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 8px 8px 0 0;
  transform-origin: top center;
  z-index: 5;
}
.env-seal {
  position: absolute; left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  width: 62px; height: 62px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 36% 32%, #c98a58, #a06a3e 55%, #8a5530);
  box-shadow:
    inset 0 0 0 3px rgba(255, 246, 230, 0.28),
    inset 0 -4px 8px rgba(70, 40, 18, 0.35),
    0 3px 10px rgba(80, 50, 25, 0.35);
  color: #fdf3e2;
  font-family: var(--serif); font-size: 20px; letter-spacing: 0;
  cursor: pointer;
  z-index: 6;
  display: flex; align-items: center; justify-content: center;
}
.env-seal span { transform: translateY(-1px); }
.env-seal:hover { filter: brightness(1.06); }

.env-hint {
  margin-top: 30px; font-size: 13px; color: var(--ink-soft);
  letter-spacing: 1.5px; transition: opacity .4s;
}
.env-hint.is-hidden { opacity: 0; }

/* 启封动画：封缄消退 → 折盖翻开 → 信纸升起 */
.env-body.is-opening { cursor: default; }
.env-body.is-opening .env-seal { animation: sealOff .5s ease forwards; }
.env-body.is-opening .env-flap { animation: flapOpen .8s ease .45s forwards; }
.env-body.is-opening .env-letter { animation: letterRise .9s cubic-bezier(.22,.7,.3,1) 1.25s forwards; }

@keyframes sealOff {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  55% { transform: translate(-50%, -50%) scale(1.16); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.68); opacity: 0; }
}
@keyframes flapOpen {
  0% { transform: rotateX(0); z-index: 5; }
  49% { transform: rotateX(-92deg); z-index: 5; }
  50% { transform: rotateX(-92deg); z-index: 1; }
  100% { transform: rotateX(-178deg); z-index: 1; }
}
@keyframes letterRise {
  0% { transform: translate(-50%, 0); }
  100% { transform: translate(-50%, -80%); }
}

/* 刚启封后的信纸入场 */
.read-main.is-unsealed .read-paper { animation: paperIn .9s cubic-bezier(.22,.7,.3,1) both; }
@keyframes paperIn {
  0% { opacity: 0; transform: translateY(26px) scale(.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 收信箱 ---------- */
.inbox-main { max-width: 720px; margin: 0 auto; padding: 34px 24px 60px; animation: rise .4s ease both; }
.letter-list { display: flex; flex-direction: column; gap: 12px; }
.letter-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px;
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.letter-item:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); }
.letter-dot {
  flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%;
  background: transparent;
}
.letter-item.is-unread .letter-dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(176, 118, 74, 0.18); }
.letter-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.letter-from { font-family: var(--serif); font-size: 15px; letter-spacing: 1px; color: var(--ink); }
.letter-item.is-unread .letter-from { color: var(--brand-deep); font-weight: 600; }
.letter-excerpt {
  font-size: 12.5px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.letter-date { flex: 0 0 auto; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- 读信 ---------- */
.read-main { max-width: 720px; margin: 0 auto; padding: 34px 24px 60px; animation: rise .4s ease both; }
.read-paper {
  background:
    repeating-linear-gradient(to bottom, transparent 0 39px, rgba(200, 180, 150, 0.18) 39px 40px),
    linear-gradient(160deg, #fffdf8, #faf3e7);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 44px 48px;
}
.read-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 18px; margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.read-from { font-family: var(--serif); font-size: 18px; letter-spacing: 2px; color: var(--brand-deep); }
.read-time { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.read-body p { font-family: var(--serif); font-size: 15.5px; line-height: 40px; color: var(--ink); margin: 0 0 18px; }
.read-body p.sig { text-align: right; color: var(--ink-soft); margin-bottom: 0; }

@media (max-width: 760px) {
  .card-grid { grid-template-columns: 1fr; }
  .hero h2 { font-size: 24px; }
  .ob-card { padding: 40px 26px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
