/* 愿望清单 · 暖纸手账风
   色值只在此处定义，页面其余处一律引用 Token。 */

:root {
  --bg: #F4EDE1;
  --paper: #FFFCF5;
  --paper-soft: #FFFDF8;
  --accent: #A9714C;
  --accent-deep: #8F5D3C;
  --accent-soft: rgba(169, 113, 76, .10);
  --ink: #463C32;
  --ink-2: #7C6F62;
  --ink-3: #A8998A;
  --line: rgba(90, 72, 52, .10);
  --line-strong: rgba(90, 72, 52, .16);
  --glow: #D9B98C;
  --shadow-paper: 0 10px 30px rgba(120, 94, 66, .07), 0 1px 2px rgba(120, 94, 66, .04);
  --font-serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STZhongsong", "SimSun", serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --t-fast: 180ms;
  --t: 320ms;
  --t-slow: 460ms;
}

* { box-sizing: border-box; }

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(120% 70% at 50% -10%, #FAF4E9 0%, rgba(250, 244, 233, 0) 62%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.sheet-open { overflow: hidden; }

[hidden] { display: none !important; }

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid rgba(169, 113, 76, .62);
  outline-offset: -2px;
}

/* ---------- 骨架 ---------- */

.app {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 100vh;
  min-height: 100dvh;
}

.header {
  padding: calc(12px + env(safe-area-inset-top)) 2px 8px;
}

.date {
  margin: 0 0 5px;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: .1em;
  color: var(--ink-3);
}

.title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--ink);
}

.subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: .02em;
  color: var(--ink-2);
}

.subtitle:empty { display: none; }

.stage {
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

/* ---------- 一整张纸 ---------- */

.paper {
  margin-top: 14px;
  background: var(--paper);
  border: 1px solid rgba(90, 72, 52, .07);
  border-radius: 18px;
  box-shadow: var(--shadow-paper);
  overflow: hidden;
}

.wish-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wish-row {
  position: relative;
  padding-left: 50px;
  border-top: 1px solid var(--line);
  -webkit-touch-callout: none;
  user-select: none;
  transition: background var(--t-fast) var(--ease);
}

.wish-row:first-child { border-top: 0; }

.wish-row:active { background: var(--accent-soft); }

@media (hover: hover) and (pointer: fine) {
  .wish-row:hover { background: rgba(169, 113, 76, .035); }
  .wish-row:hover .row-text { color: #3D342B; }
  .wish-row.is-done:hover .row-text { color: rgba(70, 60, 50, .54); }
}

/* 圆点：48×44 的触控区，视觉圆点 22px，与首行文字居中对齐 */
.check {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 100%;
  min-height: 44px;
  padding: 11px 0 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  border: 0;
  background: none;
  cursor: pointer;
}

.circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(110, 90, 70, .34);
  display: grid;
  place-items: center;
  transition:
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.circle svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--paper);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(.5);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}

.wish-row.is-done .circle {
  background: var(--accent);
  border-color: var(--accent);
}

.wish-row.is-done .circle svg {
  opacity: 1;
  transform: scale(1);
}

.circle.pop { animation: circle-pop .32s var(--ease); }

@keyframes circle-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

.row-main {
  display: block;
  width: 100%;
  padding: 9px 12px 9px 0;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.row-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: .01em;
  color: var(--ink);
  word-break: break-word;
  transition: color var(--t-fast) var(--ease);
}

.wish-row.is-done .row-text { color: rgba(70, 60, 50, .40); }

/* 已实现分隔 */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: .22em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* 落位时的暖色呼吸 */
.wish-row.is-arriving { animation: breathe 1.1s var(--ease); }

@keyframes breathe {
  0% { background: rgba(169, 113, 76, .13); }
  100% { background: rgba(169, 113, 76, 0); }
}

/* ---------- 空态 ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16vh 24px 0;
  text-align: center;
}

.empty-spark {
  width: 34px;
  height: 34px;
  margin-bottom: 18px;
  color: var(--accent);
  opacity: .42;
}

.empty-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
  letter-spacing: .06em;
}

.empty-sub {
  margin: 6px 0 22px;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-2);
}

.empty-add {
  height: 44px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(169, 113, 76, .35);
  border-radius: 999px;
  background: rgba(255, 252, 245, .72);
  color: var(--accent-deep);
  font-size: 14px;
  letter-spacing: .06em;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.empty-add svg { width: 14px; height: 14px; }

.empty-add:active {
  transform: scale(.97);
  background: var(--accent-soft);
}

/* ---------- 底部许愿 ---------- */

.add-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(420px, 100%);
  padding: 20px 24px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  background: linear-gradient(to top, var(--bg) 45%, rgba(244, 237, 225, .88) 68%, rgba(244, 237, 225, 0) 100%);
  pointer-events: none;
  z-index: 20;
}

body.is-empty .add-bar { display: none; }

.add-btn {
  pointer-events: auto;
  height: 44px;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .1em;
  box-shadow: 0 8px 20px rgba(143, 93, 60, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}

.add-btn svg { width: 15px; height: 15px; }

.add-btn:active {
  transform: scale(.96);
  background: var(--accent-deep);
  box-shadow: 0 4px 12px rgba(143, 93, 60, .18);
}

/* ---------- 鼓励语 ---------- */

.encourage {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, 8px);
  width: max-content;
  max-width: calc(100vw - 48px);
  padding: 7px 18px 8px;
  border: 1px solid rgba(90, 72, 52, .06);
  border-radius: 999px;
  background: rgba(255, 252, 245, .94);
  box-shadow: 0 8px 24px rgba(120, 94, 66, .10);
  text-align: center;
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 24px;
  letter-spacing: .08em;
  white-space: nowrap;
  color: var(--accent-deep);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}

.encourage.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 浮层 ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(60, 47, 34, .26);
  opacity: 0;
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
  transition: opacity 260ms var(--ease);
}

.scrim.is-open { opacity: 1; }

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  width: min(420px, 100%);
  padding: 8px 24px calc(20px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--paper);
  box-shadow: 0 -16px 50px rgba(80, 60, 40, .20);
  transform: translate(-50%, 100%);
  transition: transform 380ms var(--ease);
}

.sheet.is-open { transform: translate(-50%, 0); }

.sheet-grab {
  width: 36px;
  height: 4px;
  margin: 2px auto 16px;
  border-radius: 2px;
  background: var(--line-strong);
}

.sheet-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--ink);
}

.sheet-hint {
  margin: 5px 0 16px;
  font-size: 12px;
  line-height: 18px;
  color: var(--ink-3);
  letter-spacing: .02em;
}

.sheet-input {
  display: block;
  width: 100%;
  min-height: 96px;
  max-height: 170px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper-soft);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.sheet-input::placeholder { color: var(--ink-3); }

.sheet-input:focus {
  border-color: rgba(169, 113, 76, .55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.save-btn {
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  font-size: 15px;
  letter-spacing: .1em;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}

.save-btn:disabled {
  opacity: .38;
  cursor: default;
}

.save-btn:not(:disabled):active {
  transform: scale(.985);
  background: var(--accent-deep);
}

.sheet-aux {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
}

.link-btn {
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: .02em;
  cursor: pointer;
}

.link-btn:active { opacity: .6; }

.link-danger { color: #9A6350; }

.aux-dot { color: var(--ink-3); }

.sheet.is-confirming .sheet-edit { display: none; }

.confirm { padding: 12px 0 4px; text-align: center; }

.confirm-q {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 26px;
  letter-spacing: .04em;
  color: var(--ink);
}

.confirm-actions { display: flex; gap: 12px; }

.ghost-btn,
.danger-btn {
  flex: 1;
  height: 44px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: .06em;
  cursor: pointer;
}

.ghost-btn {
  border: 1px solid var(--line-strong);
  background: var(--paper-soft);
  color: var(--ink-2);
}

.ghost-btn:active { background: rgba(169, 113, 76, .05); }

.danger-btn {
  border: 0;
  background: rgba(169, 113, 76, .14);
  color: #8E5842;
}

.danger-btn:active { background: rgba(169, 113, 76, .2); }

/* ---------- 微光粒子 ---------- */

.particles {
  position: fixed;
  inset: 0;
  z-index: 29;
  overflow: hidden;
  pointer-events: none;
}

.spark {
  position: absolute;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 10px 2px rgba(217, 185, 140, .55);
  opacity: 0;
  will-change: transform, opacity;
}

/* ---------- 减少动态 ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
