/* 这是网页的"化妆品"：决定颜色、大小、好不好看。
   这一版走的是"嫩芽绿 + 圆润可爱"风格，适合小朋友。 */

/* 先把常用的颜色起个名字，方便统一修改 */
:root {
  --leaf: #7cc35a;        /* 柔和的桑叶绿（主色） */
  --leaf-dark: #56a23a;   /* 深一点的绿，用在文字/强调 */
  --leaf-deep: #4f9233;   /* 按钮的"底边"颜色，做出立体糖果感 */
  --leaf-soft: #eef7e4;   /* 很浅的绿，做背景 */
  --berry: #ff9bb0;       /* 草莓粉，点缀用 */
  --sun: #ffd76b;         /* 阳光黄，点缀用 */
  --cream: #fffefb;       /* 米白色卡片 */
  --ink: #4a4a3f;         /* 文字颜色 */
  --soft: #9aa58c;        /* 浅灰文字 */
  --shadow: 0 8px 20px rgba(95, 150, 70, 0.20);
  --shadow-soft: 0 4px 12px rgba(95, 150, 70, 0.13);
  --radius: 22px;         /* 圆角越大越圆润可爱 */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* ui-rounded 在苹果设备上是圆圆胖胖的字体，很可爱；其它设备会自动换 */
  font-family: ui-rounded, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  /* 浅绿底色 + 一层白色小圆点，像可爱的波点纸 */
  background-color: var(--leaf-soft);
  background-image: radial-gradient(rgba(255, 255, 255, 0.7) 2.5px, transparent 2.5px);
  background-size: 22px 22px;
  line-height: 1.6;
}

/* ---- 顶部标题栏 ---- */
.site-header {
  background: linear-gradient(135deg, #93d472, #69b84a);
  color: white;
  padding: 16px 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: 0 0 30px 30px;   /* 底部两个大圆角，软萌 */
  box-shadow: var(--shadow);
}
.title-group { display: flex; align-items: center; gap: 10px; }
.site-header h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

/* 小吉祥物：会轻轻摇摆 */
.mascot {
  display: block;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.12));
  transform-origin: 75% 85%;
  animation: wiggle 2.6s ease-in-out infinite;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50%      { transform: rotate(4deg) translateY(-2px); }
}
/* 如果使用者设置了"减少动画"，就乖乖不动 */
@media (prefers-reduced-motion: reduce) {
  .mascot { animation: none; }
}

/* 中间内容区域，限制最大宽度，居中显示 */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

/* 卡片：白色圆角小盒子 */
.card,
.stat-card,
.record {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ---- 成长概览的小卡片：每个一种粉嫩颜色 ---- */
.overview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.stat-card {
  flex: 1 1 100px;
  padding: 14px 10px;
  text-align: center;
  border: 2px solid #fff;
  transition: transform 0.15s ease;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card:nth-child(1) { background: #eef7e4; }
.stat-card:nth-child(2) { background: #fdeef1; }
.stat-card:nth-child(3) { background: #fff6e0; }
.stat-card:nth-child(4) { background: #eaf5fb; }
.stat-card:nth-child(5) { background: #f3eefb; }
.stat-num {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--leaf-dark);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13px; color: var(--soft); }

/* ---- 表单 ---- */
.add-card { padding: 22px; margin-bottom: 24px; }
.add-card h2,
.album h2 {
  color: var(--leaf-dark);
  margin-top: 0;
  font-size: 21px;
}
/* 标题前面放一个可爱的小圆点 */
.add-card h2::before,
.album h2::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--sun);
}
.album h2::before { background: var(--berry); }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 15px;
}
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2.5px solid #d9ecca;
  border-radius: 14px;
  font-size: 16px;        /* 16px 能避免手机上自动放大 */
  font-family: inherit;
  background: white;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(124, 195, 90, 0.18); /* 聚焦时一圈柔光 */
}
input[type="file"] {
  width: 100%;
  padding: 8px 0;
  font-size: 14px;
  border: none;
}
input[type="checkbox"] { accent-color: var(--leaf); }

/* 把两个输入框并排放 */
.field-inline {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.field.small { flex: 1 1 120px; margin-bottom: 0; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
}
.checkbox input { width: 20px; height: 20px; }

/* ---- 按钮 ---- */
/* 主按钮：胖乎乎的糖果按钮，按下去会"陷"一下 */
.primary-btn {
  background: linear-gradient(135deg, #8ed06a, #67b446);
  color: white;
  border: none;
  padding: 13px 30px;
  font-size: 17px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 5px 0 var(--leaf-deep), var(--shadow-soft);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.primary-btn:hover { transform: translateY(-2px); }
.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--leaf-deep);
}
.primary-btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}
.ghost-btn {
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  border: 2px solid rgba(255, 255, 255, 0.85);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.4); }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.admin-link { text-decoration: none; }

/* ---- 一条记录的卡片 ---- */
.record {
  padding: 18px;
  margin-bottom: 16px;
  border: 2px solid #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: popIn 0.25s ease;   /* 出现时轻轻弹一下 */
}
.record:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.record-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.record-date { font-weight: 800; font-size: 16px; }
.badge {
  color: white;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}
.record-meta {
  font-size: 14px;
  color: var(--soft);
  margin-left: auto;
}
.record-note { margin: 8px 0; white-space: pre-wrap; }

/* 照片小图排成一行 */
.thumb-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.thumb {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: #f0f0e8;
  border: 3px solid #fff;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease;
}
.thumb:hover { transform: scale(1.05); }
.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb .play-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 26px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
/* 编辑时小图右上角的删除按钮（粉色小圆） */
.thumb .remove-x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: var(--berry);
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.record-actions { display: flex; gap: 14px; margin-top: 10px; }
.link-btn {
  background: none;
  border: none;
  color: var(--leaf-dark);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 0;
  text-decoration: underline;
}
.link-btn.danger { color: #e06a8e; }

/* 没有记录时的提示：一个虚线圆角小框 */
.empty {
  text-align: center;
  color: var(--soft);
  padding: 36px 20px;
  border: 3px dashed #cfe6bb;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}

/* "上传中…" 的小提示 */
.uploading-note {
  color: var(--leaf-dark);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 2px;
}

/* ---- 看大图的弹窗 ---- */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}
.modal-content {
  position: relative;
  max-width: 92vw;
  max-height: 88vh;
  z-index: 1;
}
.modal-content img,
.modal-content video {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 18px;
  border: 4px solid #fff;
  display: block;
}
.modal-x {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: white;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

.hidden { display: none; }

/* ===== 桑叶小农场（小游戏） ===== */
.garden-card { padding: 22px; margin-bottom: 24px; position: relative; }
.garden-card h2 {
  color: var(--leaf-dark);
  margin-top: 0;
  font-size: 21px;
}
.garden-card h2::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--leaf);
}

/* 天气小徽章（卡片右上角） */
.weather-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f3f7ea;
  border-radius: 999px;
  padding: 4px 12px 4px 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--leaf-dark);
  box-shadow: var(--shadow-soft);
}
.weather-badge .wicon { width: 22px; height: 22px; display: block; }

/* 植物区按天气换一点底色 */
.plant-area { border-radius: 18px; transition: background 0.6s ease; }
.plant-area.weather-sunny  { background: radial-gradient(circle at 50% 32%, rgba(255, 210, 80, 0.30), rgba(255, 210, 80, 0) 70%); }
.plant-area.weather-rainy  { background: linear-gradient(rgba(120, 170, 210, 0.22), rgba(120, 170, 210, 0.08)); }
.plant-area.weather-cloudy { background: rgba(200, 208, 196, 0.18); }
.plant-area.weather-windy  { background: rgba(190, 210, 170, 0.20); }
.garden-main {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.plant-area {
  width: 140px;
  height: 168px;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0 auto;
}
.plant-area svg { width: 132px; height: auto; }
/* 桑树长大、变蔫都来一点平滑过渡 */
.plant-area .plant { transition: transform 0.5s ease; }
.plant-area .bug { animation: bugmove 0.7s ease-in-out infinite alternate; }
@keyframes bugmove {
  from { transform: translate(80px, 72px) rotate(-6deg); }
  to   { transform: translate(84px, 70px) rotate(6deg); }
}

.garden-info { flex: 1 1 220px; min-width: 200px; }
.stage-line { font-weight: 800; color: var(--leaf-dark); margin-bottom: 10px; font-size: 16px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar-label { width: 36px; font-size: 13px; color: var(--soft); text-align: right; }
.bar {
  flex: 1;
  height: 15px;
  background: #edefe7;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.bar.grow  .bar-fill { background: linear-gradient(90deg, #9be36a, #56a23a); }
.bar.water .bar-fill { background: linear-gradient(90deg, #93d3f2, #4aa3e0); }
.bar.fert  .bar-fill { background: linear-gradient(90deg, #e0bd8c, #b07d4a); }
.bar.sun   .bar-fill { background: linear-gradient(90deg, #ffe08a, #ffc23d); }

.garden-msg {
  margin: 14px 0;
  font-weight: 700;
  color: var(--leaf-dark);
  min-height: 1.4em;
  text-align: center;
}

.garden-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.game-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.14);
  transition: transform 0.1s ease;
}
.game-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.14); }
.game-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; transform: none; }
.game-btn.water   { background: #4aa3e0; }
.game-btn.fert    { background: #b07d4a; }
.game-btn.sun     { background: #f0ad2e; }
.game-btn.bug     { background: #e06a8e; }
.game-btn.harvest { background: #56a23a; }
.game-btn.feed    { background: #8a6fd0; }

.garden-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
}
.leaf-store b, .fed-count b { color: var(--leaf-dark); font-size: 17px; }

/* 喂蚕宝宝时，头顶小吉祥物开心地跳一下 */
.mascot.happy { animation: happybounce 0.8s ease; }
@keyframes happybounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30%      { transform: translateY(-8px) scale(1.12); }
  60%      { transform: translateY(0) scale(1); }
}

/* ===== 点击小特效 & 彩花 ===== */
.fx-particle { position: fixed; width: 14px; height: 14px; pointer-events: none; z-index: 2000; animation: fxfloat 0.9s ease-out forwards; }
.fx-leaf { background: #7cc35a; border-radius: 0 60% 0 60%; }
.fx-spark { background: #ffd76b; border-radius: 2px; }
@keyframes fxfloat {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to   { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}
.fx-confetti { position: fixed; top: -16px; width: 9px; height: 14px; border-radius: 2px; pointer-events: none; z-index: 2000; animation: fxfall var(--dur) linear forwards; }
@keyframes fxfall {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to   { transform: translate(var(--cx), var(--fall)) rotate(var(--rot)); opacity: 0.9; }
}

/* ===== 白天黑夜（夜晚的月亮、星星、萤火虫） ===== */
.plant-area { position: relative; overflow: hidden; }
.plant-area svg { position: relative; z-index: 1; }
.plant-area.night { background: linear-gradient(#22305a, #3c4c74) !important; }
.sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.sky .moon { position: absolute; top: 12%; right: 14%; width: 26px; height: 26px; border-radius: 50%; background: #fdf6c9; box-shadow: 0 0 12px rgba(253, 246, 201, 0.85); }
.sky .star { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; animation: twinkle 2.2s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.sky .firefly { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #f4f97a; box-shadow: 0 0 8px 2px rgba(244, 249, 122, 0.9); animation: flit 3s ease-in-out infinite; }
@keyframes flit {
  0%   { transform: translate(0, 0);     opacity: 0.2; }
  25%  { opacity: 1; }
  50%  { transform: translate(10px, -8px); opacity: 0.5; }
  75%  { opacity: 1; }
  100% { transform: translate(-6px, 4px);  opacity: 0.2; }
}

/* ===== 桑葚计数 & 摆装饰按钮 ===== */
.berry-store b { color: #8e44ad; font-size: 17px; }
.decor-row { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.decor-label { font-size: 14px; color: var(--soft); }
.decor-btn {
  border: 2px solid #d9ecca;
  background: #fff;
  color: var(--leaf-dark);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.decor-btn.on { background: var(--leaf); color: #fff; border-color: var(--leaf); }

/* ===== 成长时光机 ===== */
.timemachine-card { padding: 22px; margin-bottom: 24px; }
.timemachine-card h2 { color: var(--leaf-dark); margin-top: 0; font-size: 21px; }
.timemachine-card h2::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: #8fb3ea;
}
.tm-stage {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: var(--shadow-soft);
  background: #eef0e8;
}
.tm-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tm-dates { display: flex; justify-content: space-between; max-width: 360px; margin: 8px auto 0; font-size: 13px; color: var(--soft); font-weight: 600; }
.tm-slider { width: 100%; max-width: 360px; display: block; margin: 12px auto 0; accent-color: var(--leaf); }
.tm-caption { text-align: center; color: var(--leaf-dark); font-weight: 700; margin-top: 10px; }
.tm-hint { text-align: center; color: var(--soft); padding: 20px; }

/* ===== 养蚕广场：筛选按钮 + "谁记的"名牌 ===== */
.plaza-filter { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-btn {
  border: 2px solid #d9ecca;
  background: #fff;
  color: var(--leaf-dark);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.filter-btn.on { background: var(--leaf); color: #fff; border-color: var(--leaf); }

/* "谁记的"小名牌（蓝色小胶囊，一眼看出是哪位小蚕农）*/
.owner-tag {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #8fb3ea;
  padding: 3px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.10);
}

/* "加载更多"按钮（虚线圆角，点一下多看一页）*/
.load-more-btn {
  display: block;
  margin: 10px auto 4px;
  padding: 10px 26px;
  border: 2px dashed #cfe6bb;
  background: #fff;
  color: var(--leaf-dark);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.load-more-btn:hover { background: var(--leaf-soft); border-color: var(--leaf); }

/* ===== 进入小广场 ===== */
.entry-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(238, 247, 228, 0.96);
}
.entry-panel {
  width: min(420px, 100%);
  background: var(--cream);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
  padding: 24px;
}
.entry-panel h2 {
  margin: 0 0 16px;
  color: var(--leaf-dark);
  text-align: center;
}
.entry-mascot {
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ecf5d6;
  color: var(--leaf-dark);
  font-weight: 800;
  border: 3px solid #fff;
  box-shadow: var(--shadow-soft);
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 18px;
}
.avatar-choice {
  border: 2px solid #d9ecca;
  background: #fff;
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.avatar-choice.on {
  background: var(--leaf);
  border-color: var(--leaf);
  color: #fff;
}
.entry-error,
.admin-msg {
  min-height: 24px;
  color: #c0392b;
  font-weight: 700;
}

/* 屏幕宽的时候（电脑），标题大一点 */
@media (min-width: 600px) {
  .site-header h1 { font-size: 31px; }
}
