/* =========================================================
   莫垚 · 零件：卡片 / 按钮 / 输入 / toast / 弹窗 / 灯箱 / 骨架 / 空态
   ========================================================= */

/* ---------------- 卡片：奶油玻璃 ---------------- */
.card {
  position: relative;
  border-radius: var(--r-2);
  background: var(--card);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  backdrop-filter: blur(14px) saturate(1.05);
  border: 1px solid var(--white-line);
  box-shadow: var(--sh-1);
  padding: clamp(18px, 2.2vw, 26px);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: rgba(255, 255, 255, .9);
  pointer-events: none;
}

.card > * { position: relative; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.card-title {
  font-size: 16px;
  letter-spacing: .06em;
  color: var(--ink);
}

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .62);
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap;
}

.tag--rose { color: var(--rose-deep); box-shadow: inset 0 0 0 1px rgba(185, 107, 98, .28); background: rgba(245, 220, 214, .5); }
.tag--sage { color: #6E7F69; box-shadow: inset 0 0 0 1px rgba(154, 174, 150, .38); background: rgba(226, 233, 222, .5); }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-top: .55em;
}

.dot--sage { background: var(--sage); }
.dot--rose { background: var(--rose); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px var(--line), var(--sh-1);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  background: rgba(255, 255, 255, .92);
  box-shadow: inset 0 0 0 1px var(--line-2), var(--sh-2);
}

.btn:active { transform: translateY(1px) scale(.995); }

.btn[disabled],
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn-primary {
  color: #FFFBF5;
  background: linear-gradient(180deg, var(--rose) 0%, var(--rose-deep) 100%);
  box-shadow: var(--sh-2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #DF958F 0%, #BF6F66 100%);
  box-shadow: var(--sh-3);
}

.btn-soft {
  color: var(--ink);
  background: rgba(241, 227, 211, .72);
  box-shadow: inset 0 0 0 1px rgba(201, 141, 107, .22);
}

.btn-soft:hover { background: rgba(241, 227, 211, .95); }

.btn-ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
}

.btn-ghost:hover { background: rgba(255, 255, 255, .6); color: var(--ink); }

.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .56);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .9); box-shadow: inset 0 0 0 1px var(--line-2); }
.icon-btn[hidden] { display: none !important; }

.id-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px 0 10px;
  border-radius: var(--r-pill);
  font-size: 13px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .56);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.id-btn:hover { background: rgba(255, 255, 255, .92); color: var(--ink); }

.id-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #E7EFE3, #93A58D);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
}

.id-btn[data-tone="b"]::before {
  background: radial-gradient(circle at 35% 30%, #FCE7E0, #D08F87);
}

/* 音乐三根条 */
.music-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.music-bars i {
  display: block;
  width: 2px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  transition: height var(--t-mid) var(--ease);
}

#musicBtn.is-playing { color: var(--rose-deep); }
#musicBtn.is-playing .music-bars i:nth-child(1) { animation: barA 1.1s var(--ease) infinite; }
#musicBtn.is-playing .music-bars i:nth-child(2) { animation: barB .9s var(--ease) infinite; }
#musicBtn.is-playing .music-bars i:nth-child(3) { animation: barA 1.35s var(--ease) infinite .12s; }

@keyframes barA {
  0%, 100% { height: 4px; }
  50% { height: 13px; }
}

@keyframes barB {
  0%, 100% { height: 11px; }
  50% { height: 3px; }
}

/* ---------------- 表单 ---------------- */
.field {
  display: block;
  margin-bottom: var(--sp-4);
}

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: var(--r-1);
  background: rgba(255, 255, 255, .76);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.input::placeholder,
.textarea::placeholder { color: rgba(110, 98, 89, .55); }

.input:hover,
.textarea:hover { border-color: var(--line-2); }

.input:focus,
.textarea:focus {
  outline: none;
  background: #FFFDF8;
  border-color: rgba(217, 140, 134, .55);
  box-shadow: 0 0 0 3px rgba(217, 140, 134, .12);
}

.textarea {
  resize: vertical;
  min-height: 84px;
  field-sizing: content;
}

.input[type="date"] { min-height: 44px; }

/* ---------------- toast ---------------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 420px);
}

.toast {
  pointer-events: auto;
  max-width: 100%;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: rgba(255, 253, 248, .95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--white-line);
  box-shadow: var(--sh-2);
  color: var(--ink);
  font-size: 13.5px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}

.toast.is-in { opacity: 1; transform: translateY(0); }
.toast.is-warn { color: var(--rose-deep); }

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
}

.modal.is-in { opacity: 1; }

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(59, 50, 44, .28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(100%, 460px);
  max-height: 86dvh;
  overflow: auto;
  border-radius: var(--r-3);
  padding: clamp(22px, 3vw, 32px);
  transform: translateY(10px) scale(.99);
  transition: transform var(--t-mid) var(--ease);
}

.modal.is-in .modal-card { transform: none; }

.modal-title {
  font-size: 19px;
  margin-bottom: var(--sp-4);
  letter-spacing: .04em;
}

.modal-text {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.85;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  flex-wrap: wrap;
}

/* ---------------- 灯箱 ---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 40px);
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
}

.lightbox[hidden] { display: none; }
.lightbox.is-in { opacity: 1; }

.lb-scrim {
  position: absolute;
  inset: 0;
  background: rgba(38, 31, 27, .78);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}

.lb-stage {
  position: relative;
  margin: 0;
  max-width: min(94vw, 900px);
  max-height: 86dvh;
  display: grid;
  gap: var(--sp-3);
  transition: transform var(--t-mid) var(--ease);
}

.lb-media {
  border-radius: var(--r-2);
  overflow: hidden;
  background: rgba(255, 253, 248, .08);
  box-shadow: var(--sh-3);
  display: grid;
  place-items: center;
  max-height: 74dvh;
}

.lb-media img,
.lb-media video {
  max-width: min(94vw, 900px);
  max-height: 74dvh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lb-media svg { width: min(70vw, 420px); height: auto; }

.lb-cap {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  color: rgba(255, 251, 245, .92);
  font-size: 13px;
  line-height: 1.6;
}

.lb-date { color: rgba(255, 251, 245, .62); flex: 0 0 auto; }

.lb-close,
.lb-nav {
  position: absolute;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: rgba(255, 251, 245, .92);
  background: rgba(255, 253, 248, .12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
  transition: background var(--t-fast) var(--ease);
}

.lb-close:hover,
.lb-nav:hover { background: rgba(255, 253, 248, .24); }

.lb-close { top: calc(14px + env(safe-area-inset-top)); right: 14px; }
.lb-prev { left: 10px; top: 50%; margin-top: -22px; }
.lb-next { right: 10px; top: 50%; margin-top: -22px; }
.lb-nav[hidden] { display: none; }

/* ---------------- 骨架 ---------------- */
.sk-card { padding: var(--sp-5); }

.sk {
  border-radius: var(--r-1);
  background: linear-gradient(90deg, rgba(226, 208, 189, .48) 0%, rgba(255, 253, 248, .96) 42%, rgba(226, 208, 189, .48) 84%);
  background-size: 220% 100%;
  animation: skMove 1.9s linear infinite;
}

.sk-title { height: 16px; width: 42%; margin-bottom: var(--sp-4); }
.sk-line { height: 10px; margin-bottom: 10px; opacity: .8; }

@keyframes skMove {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

.ring-skeleton {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  margin: 6px auto;
  background: conic-gradient(rgba(217, 140, 134, .28) 0 42%, rgba(241, 227, 211, .5) 0);
  mask: radial-gradient(circle, transparent 54%, #000 56%);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 56%);
}

/* ---------------- 空态 ---------------- */
.empty-block {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--ink-2);
}

.empty-art { width: 120px; opacity: .9; }

/* ---------------- 飘落物 ---------------- */
.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  overflow: hidden;
}

.fx-heart {
  position: fixed;
  color: var(--rose);
  transform: translate(-50%, -50%);
  animation: heartFly var(--dur, 1400ms) var(--ease) forwards;
  will-change: transform, opacity;
}

.fx-heart.is-soft { color: var(--blush); }
.fx-heart--mini { color: var(--rose); }

@keyframes heartFly {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6) rotate(0deg); }
  22% { opacity: 1; transform: translate(calc(-50% + var(--dx, 0px) * .3), calc(-50% + var(--dy, -60px) * .3)) scale(1.05) rotate(calc(var(--rot, 0deg) * .4)); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -80px))) scale(.82) rotate(var(--rot, 0deg)); }
}

.petal {
  position: absolute;
  top: -24px;
  width: var(--size, 8px);
  height: calc(var(--size, 8px) * 1.35);
  border-radius: 60% 40% 55% 45% / 55% 55% 45% 45%;
  background: linear-gradient(160deg, rgba(245, 220, 214, .85), rgba(217, 140, 134, .55));
  animation: petalFall var(--dur, 18000ms) linear var(--delay, 0ms) infinite;
  will-change: transform, opacity;
  pointer-events: none;
}

.petal--bloom {
  background: linear-gradient(160deg, #FBE7E2, #E7AFA7);
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

@keyframes petalFall {
  0% { transform: translate3d(0, -10px, 0) rotate(0deg); opacity: 0; }
  12% { opacity: .85; }
  100% { transform: translate3d(var(--drift, 20px), var(--fall, 900px), 0) rotate(var(--spin, 220deg)); opacity: 0; }
}

/* ---------------- 信 ---------------- */
.letter {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, .96), rgba(251, 243, 233, .96));
  border-radius: var(--r-1);
  padding: clamp(16px, 3vw, 26px);
  box-shadow: inset 0 0 0 1px rgba(201, 141, 107, .22);
}

.letter-line {
  font-family: var(--font-title);
  font-size: 15px;
  line-height: 2.05;
  color: #4A3F37;
  letter-spacing: .04em;
  margin-bottom: var(--sp-3);
  max-width: none;
}

.letter-line:last-child { margin-bottom: 0; text-align: right; }
