/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  background: #c9e9fb;
  user-select: none;
  -webkit-user-select: none;
}

/* ============ 视口与画布 ============ */
.view {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #a9dcf5 0%, #d3eefb 28%, #eef9ec 58%, #c2eac4 84%, #8ed39d 100%);
}

.app {
  position: absolute;
  left: 0;
  top: 0;
  width: 375px;
  height: 800px;
  background: linear-gradient(180deg, #a9dcf5 0%, #d3eefb 28%, #eef9ec 58%, #c2eac4 84%, #8ed39d 100%);
  transform-origin: 0 0;
  will-change: transform;
  overflow: hidden;
}

#scene { position: absolute; inset: 0; width: 375px; height: 800px; }

/* ============ 顶部标题 ============ */
.hd {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding-top: 20px;
  text-align: center;
  z-index: 4;
  pointer-events: none;
}

.hd-tag {
  display: inline-block;
  font-size: 11px;
  color: #fff;
  background: rgba(41, 150, 110, 0.75);
  padding: 4px 14px;
  border-radius: 999px;
  letter-spacing: 3px;
  box-shadow: 0 3px 8px rgba(30, 90, 70, 0.18);
  backdrop-filter: blur(4px);
}

.hd-title {
  margin-top: 9px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 3px 0 rgba(52, 120, 88, 0.35), 0 6px 14px rgba(40, 110, 80, 0.25);
  filter: drop-shadow(0 0 0 transparent);
}

.hd-title span {
  color: #ffe57a;
  text-shadow: 0 3px 0 rgba(200, 130, 20, 0.35), 0 6px 14px rgba(150, 90, 20, 0.25);
}

.hd-sub {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 4px rgba(40, 110, 80, 0.4);
  letter-spacing: 1px;
}

/* ============ 树上纸条层 / 飞行层 ============ */
#notesLayer,
#flyLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#notesLayer { z-index: 3; }
#flyLayer  { z-index: 20; }

/* ============ 树冠装饰便利贴（随机垂挂） ============ */
.deco-note {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* 垂挂细绳：系点位于纸顶中心，向上延伸进树冠 */
.deco-note::after {
  content: "";
  position: absolute;
  left: 0;
  top: calc(-1 * var(--hl, 16px));
  width: 2px;
  height: var(--hl, 16px);
  margin-left: -1px;
  background: linear-gradient(to bottom, rgba(150, 105, 50, 0.5), rgba(110, 75, 40, 0.95));
  border-radius: 1px;
}

/* 便签纸：负责定位与整体倾斜（不受动画覆盖） */
.dn-paper {
  position: absolute;
  left: -33px;
  top: 0;
  width: 66px;
  transform: rotate(var(--rot, 0deg));
  transform-origin: top center;
}

/* 摆动层 = 整张纸：背景/圆角/阴影/文字一起以纸顶为轴晃动 */
.dn-sway {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 5px 5px;
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border-radius: 4px 11px 6px 6px;
  box-shadow: 0 4px 9px rgba(30, 70, 40, 0.24);
  opacity: 0.96;
  transform-origin: top center;
  animation: dnSway 3.8s ease-in-out infinite;
  animation-delay: var(--dly, 0s);
}

@keyframes dnSway {
  0%, 100% { transform: rotate(-2.4deg); }
  50%      { transform: rotate(2.4deg); }
}

.dn-paper .dn-ico { font-size: 16px; line-height: 1; }
.dn-paper .dn-txt {
  font-size: 10px;
  color: #57483a;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ 树上小纸条 ============ */
.note-wrap {
  position: absolute;
  width: 66px;
  pointer-events: auto;
  cursor: pointer;
  transform-origin: top center;
}

.note-on-tree {
  display: block;
  width: 66px;
  min-height: 56px;
  padding: 3px 4px 5px;
  background: var(--soft);
  border-radius: 5px 11px 7px 7px;
  box-shadow: 0 4px 8px rgba(40, 70, 40, 0.28);
  overflow: visible;
  animation: notePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.note-on-tree .nt-band {
  display: block;
  height: 13px;
  line-height: 13px;
  padding: 0 4px;
  border-radius: 4px 8px 4px 4px;
  background: var(--col);
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.note-on-tree .nt-band .nt-ico { margin-right: 2px; }

.note-on-tree .nt-text {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.35;
  color: #57483a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

/* 顶部胶带 */
.note-on-tree::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 30px;
  height: 8px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* 挂在树枝上的小绳 */
.note-on-tree::after {
  content: "";
  position: absolute;
  top: -16px;
  left: 50%;
  width: 1.6px;
  height: 12px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(90, 60, 30, 0.55), rgba(90, 60, 30, 0.35));
}

@keyframes notePop {
  0%   { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  60%  { transform: scale(1.12) rotate(1.5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ============ 底部三张便利贴入口 ============ */
.cards { position: absolute; inset: 0; z-index: 6; pointer-events: none; }

.wish-btn {
  position: absolute;
  top: 654px;
  left: var(--x);
  width: 105px;
  height: 132px;
  border: none;
  border-radius: 8px 26px 14px 14px;
  background: var(--col);
  cursor: pointer;
  padding: 0;
  transform: rotate(var(--r));
  transform-origin: 50% 92%;
  filter: drop-shadow(0 12px 12px rgba(50, 80, 40, 0.25));
  animation: cardIn 0.7s cubic-bezier(0.34, 1.5, 0.5, 1) backwards;
  transition: transform 0.22s ease;
  pointer-events: auto;
  overflow: hidden;
}

.wish-btn:nth-of-type(1) { animation-delay: 0.05s; }
.wish-btn:nth-of-type(2) { animation-delay: 0.16s; }
.wish-btn:nth-of-type(3) { animation-delay: 0.27s; }

.wish-btn:hover,
.wish-btn:active { transform: rotate(var(--r)) translateY(-5px) scale(1.05); }
.wish-btn:active { transform: rotate(var(--r)) translateY(-2px) scale(0.97); }

/* 便利贴翻起的角 */
.wish-btn::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 22px;
  height: 22px;
  background: linear-gradient(225deg, rgba(255, 255, 255, 0.9) 50%, var(--deep) 50%);
  border-bottom-left-radius: 10px;
}

.wb {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 12px 8px 14px;
}

.wb-ico { font-size: 34px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.12)); }
.wb-name {
  margin-top: 9px;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1.5px 0 rgba(0, 0, 0, 0.18);
  letter-spacing: 2px;
}
.wb-tip {
  margin-top: 7px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.28);
  padding: 3px 11px;
  border-radius: 999px;
  letter-spacing: 1px;
}

/* 三类颜色 */
.c-food    { --col: #ffc85c; --deep: #e09c1f; --soft: #fff4d9; }
.c-service { --col: #ff97a6; --deep: #e25a76; --soft: #ffe5ea; }
.c-env     { --col: #74d5a0; --deep: #28a672; --soft: #def6e9; }

@keyframes cardIn {
  0%   { transform: rotate(var(--r)) translateY(46px) scale(0.6); opacity: 0; }
  70%  { transform: rotate(var(--r)) translateY(-4px) scale(1.03); opacity: 1; }
  100% { transform: rotate(var(--r)) translateY(0) scale(1); opacity: 1; }
}

/* ============ 飞行的纸条 ============ */
.fly-note {
  position: absolute;
  left: 0;
  top: 0;
  width: 66px;
  padding: 3px 4px 5px;
  background: var(--soft);
  border-radius: 5px 11px 7px 7px;
  box-shadow: 0 8px 18px rgba(30, 60, 30, 0.35);
  pointer-events: none;
  will-change: transform;
}

.fly-note .nt-band {
  display: block;
  height: 13px;
  line-height: 13px;
  padding: 0 4px;
  border-radius: 4px 8px 4px 4px;
  background: var(--col);
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fly-note .nt-text {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.35;
  color: #57483a;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 飞行的拖尾 */
.fly-note .trail {
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 14px;
  height: 8px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.75), transparent);
}

/* ============ 落地花瓣 ============ */
.pt {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 70% 30% 60% 40%;
  opacity: 0;
  pointer-events: none;
  animation: ptFly var(--pd, 800ms) cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}

@keyframes ptFly {
  0%   { opacity: 1; transform: translate(-4px, -4px) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.7); }
}

/* ============ 弹窗 ============ */
.modal { position: absolute; inset: 0; z-index: 30; }
.modal[hidden] { display: none; }

.modal .mask {
  position: absolute;
  inset: 0;
  background: rgba(18, 42, 40, 0.55);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.25s ease both;
}

.sheet {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 316px;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: sheetIn 0.32s cubic-bezier(0.34, 1.4, 0.5, 1) both;
}

.sheet .x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.sheet .x:active { transform: scale(0.9); }

.m-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  background: var(--col, #ffc85c);
  background-image: linear-gradient(135deg, var(--col) 0%, var(--deep) 130%);
}

.m-ico {
  width: 42px;
  height: 42px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 13px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.m-titles { display: flex; flex-direction: column; min-width: 0; }
.m-name {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.m-sub {
  margin-top: 3px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.35;
}

.m-body { padding: 14px 16px 6px; position: relative; }
.m-body textarea {
  width: 100%;
  height: 132px;
  resize: none;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--soft, #fff4d9);
  padding: 12px;
  font-size: 15px;
  line-height: 1.6;
  color: #44382b;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
  user-select: text;
  -webkit-user-select: text;
}
.m-body textarea:focus {
  border-color: var(--deep, #e09c1f);
  background: #fff;
}
.m-body textarea::placeholder { color: rgba(90, 75, 55, 0.45); }

.m-count {
  margin-top: 7px;
  text-align: right;
  font-size: 12px;
  color: #b7ab9b;
}
.m-count span { font-weight: 700; color: var(--deep, #e09c1f); }
.m-count.warn span { color: #e25a5a; }

.m-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 16px;
}

.m-ok {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--col) 0%, var(--deep) 140%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s, filter 0.15s;
}
.m-ok:active { transform: scale(0.96); filter: brightness(1.05); }
.m-ok:disabled { filter: grayscale(0.55) brightness(1.15); box-shadow: none; cursor: not-allowed; }

.m-del {
  height: 40px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: #f6eee6;
  color: #b06a5a;
  font-size: 13px;
  cursor: pointer;
  flex: none;
}
.m-del:active { transform: scale(0.96); }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn { from { opacity: 0; transform: translate(-50%, -46%) scale(0.85); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* ============ toast ============ */
.toast {
  position: absolute;
  left: 50%;
  bottom: 132px;
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(30, 55, 40, 0.88);
  color: #fff;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  animation: toastIn 0.3s ease both;
}
.toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
