/* 森林手账本全局样式 */
:root {
  --moss-green: #5B8C5A;      /* 苔藓绿 */
  --honey-acorn: #F4C97E;     /* 蜜糖橡果 */
  --bark-cream: #FFF6E8;      /* 树皮奶油 */
  --berry-pink: #B2456E;      /* 莓果粉 */
  --dark-wood: #4A3728;       /* 树皮深褐 */
  --leaf-shadow: rgba(91, 140, 90, 0.15);
}

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

body {
  background-color: var(--bark-cream);
  color: var(--dark-wood);
  font-family: "Quicksand", "Comic Sans MS", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  padding-bottom: 60px;
  min-height: 100vh;
  background-image: 
    radial-gradient(var(--leaf-shadow) 1px, transparent 1px),
    radial-gradient(var(--leaf-shadow) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

/* 顶部返回首页导航 */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(255, 246, 232, 0.9);
  backdrop-filter: blur(5px);
  border-bottom: 2px dashed var(--moss-green);
  position: sticky;
  top: 0;
  z-index: 100;
}

.back-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--moss-green);
  text-decoration: none;
  font-weight: bold;
  font-size: 1rem;
  padding: 6px 12px;
  border: 2px solid var(--moss-green);
  border-radius: 20px;
  background: white;
  transition: all 0.2s ease;
}

.back-home-btn:hover {
  background: var(--moss-green);
  color: white;
  transform: scale(1.05);
}

/* 页面容器 */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* 标题样式 */
.app-header {
  text-align: center;
  margin: 20px 0 30px;
}

.app-title {
  font-size: 2.2rem;
  color: var(--moss-green);
  text-shadow: 2px 2px 0px var(--honey-acorn);
  display: inline-block;
  position: relative;
}

.app-title::after {
  content: "🌱";
  position: absolute;
  top: -15px;
  right: -30px;
  font-size: 1.5rem;
  transform: rotate(15deg);
}

.app-subtitle {
  font-size: 0.95rem;
  color: #7A624E;
  margin-top: 5px;
  font-style: italic;
}

/* 树木卡片 (仿软木板便签，微翘边) */
.tree-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 480px) {
  .tree-grid {
    grid-template-columns: 1fr;
  }
}

.tree-card {
  background: #FFFDF9;
  border: 1px solid #E6DEC9;
  border-radius: 16px;
  padding: 20px;
  position: relative;
  box-shadow: 3px 5px 12px rgba(74, 55, 40, 0.08);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
}

/* 翘边效果 */
.tree-card::before {
  content: "";
  position: absolute;
  bottom: 8px;
  right: 10px;
  width: 80px;
  height: 15px;
  box-shadow: 0 12px 10px rgba(74, 55, 40, 0.15);
  transform: rotate(4deg);
  z-index: -1;
}

/* 叶子图钉 */
.tree-card::after {
  content: "🍃";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-10deg);
  font-size: 1.4rem;
  filter: drop-shadow(1px 2px 1px rgba(0,0,0,0.1));
}

.tree-card:hover {
  transform: translateY(-5px) rotate(1deg);
  box-shadow: 5px 10px 18px rgba(74, 55, 40, 0.12);
}

.tree-card-title {
  font-size: 1.25rem;
  color: var(--moss-green);
  font-weight: bold;
  margin-bottom: 8px;
  border-bottom: 2px dashed #F0E8D5;
  padding-bottom: 4px;
}

.tree-card-info {
  font-size: 0.85rem;
  color: #8C7561;
  margin-bottom: 12px;
}

.tree-card-info span {
  background: var(--honey-acorn);
  color: var(--dark-wood);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.75rem;
  margin-right: 5px;
}

.tree-card-summary {
  font-size: 0.9rem;
  color: #5C4A3C;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

/* 新增一棵树按钮 (圆形嫩芽) */
.add-tree-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 64px;
  height: 64px;
  background-color: var(--berry-pink);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(178, 69, 110, 0.4);
  z-index: 99;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.add-tree-btn::before {
  content: "🌱";
  font-size: 1.6rem;
}

.add-tree-btn:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 6px 20px rgba(178, 69, 110, 0.5);
}

/* 水彩涟漪动画 */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(244, 201, 126, 0.6);
  transform: scale(0);
  animation: ripple-effect 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-effect {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* 弹窗样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(74, 55, 40, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: #FFFDF9;
  border: 4px solid var(--moss-green);
  border-radius: 24px;
  width: 90%;
  max-width: 420px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  transform: scale(0.8);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  position: relative;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-card::before {
  content: "🍂";
  position: absolute;
  top: -15px;
  left: 20px;
  font-size: 1.8rem;
}

.modal-title {
  font-size: 1.5rem;
  color: var(--moss-green);
  text-align: center;
  margin-bottom: 20px;
}

/* 表单元素 */
.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--dark-wood);
  font-size: 0.95rem;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #E6DEC9;
  border-radius: 12px;
  background-color: white;
  color: var(--dark-wood);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--moss-green);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 15px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-secondary {
  background: #E6DEC9;
  color: var(--dark-wood);
}

.btn-secondary:hover {
  background: #D9CEB4;
}

.btn-primary {
  background: var(--berry-pink);
  color: white;
}

.btn-primary:hover {
  background: #9E385E;
  transform: translateY(-2px);
}

/* 树木详情页 */
.tree-header-card {
  background: #FFFDF9;
  border: 2px solid var(--moss-green);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 25px;
  position: relative;
  box-shadow: 0 6px 15px rgba(91, 140, 90, 0.1);
}

.tree-header-card::after {
  content: "🌳";
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 2.5rem;
}

.tree-title {
  font-size: 1.8rem;
  color: var(--moss-green);
  margin-bottom: 8px;
}

.tree-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.9rem;
  color: #7A624E;
}

.tree-meta-item {
  background: rgba(244, 201, 126, 0.4);
  padding: 4px 10px;
  border-radius: 10px;
}

/* 时间轴 */
.timeline {
  position: relative;
  padding-left: 30px;
  margin-top: 30px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: var(--moss-green);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 30px;
  animation: fade-in 0.5s ease-out forwards;
}

.timeline-dot {
  position: absolute;
  left: -27px;
  top: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--honey-acorn);
  border: 4px solid var(--moss-green);
  z-index: 2;
}

.timeline-card {
  background: white;
  border: 1px solid #E6DEC9;
  border-radius: 16px;
  padding: 15px;
  box-shadow: 2px 4px 10px rgba(0,0,0,0.04);
  transition: transform 0.2s;
}

.timeline-card:hover {
  transform: translateX(5px);
}

.timeline-time {
  font-size: 0.8rem;
  color: #8C7561;
  margin-bottom: 6px;
  font-weight: bold;
}

.timeline-content {
  font-size: 0.95rem;
  color: var(--dark-wood);
  white-space: pre-wrap;
}

/* 树叶轮廓日记输入区 */
.leaf-container {
  background: #FFFDF9;
  border: 3px solid var(--moss-green);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; /* 树叶形状 */
  padding: 40px 30px;
  min-height: 350px;
  box-shadow: 0 10px 25px var(--leaf-shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
}

.leaf-container::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(91, 140, 90, 0.15); /* 叶脉中脉 */
  z-index: 1;
  pointer-events: none;
}

.leaf-textarea {
  width: 85%;
  height: 180px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--dark-wood);
  resize: none;
  outline: none;
  z-index: 2;
  line-height: 1.8;
  text-align: center;
  /* 瓢虫光标样式 */
  caret-color: var(--berry-pink);
}

/* 瓢虫光标指示器 */
.ladybug-cursor {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--berry-pink);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  display: none;
}

.ladybug-cursor::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 3px;
  width: 3px;
  height: 3px;
  background: black;
  border-radius: 50%;
  box-shadow: 5px 0 black, 2px 4px black, 3px -2px black;
}

/* 粒子飘落 */
.particle {
  position: fixed;
  pointer-events: none;
  z-index: 999;
  font-size: 1.2rem;
  animation: fall-and-spin 3s linear forwards;
}

@keyframes fall-and-spin {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  border: 2px dashed #D9CEB4;
  margin-top: 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.empty-text {
  color: #8C7561;
}

/* 提示条 Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--moss-green);
  color: white;
  padding: 12px 24px;
  border-radius: 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  font-weight: bold;
}

.toast.active {
  transform: translateX(-50%) translateY(0);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
