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

:root {
  --sky-1: #bfe9ff;
  --sky-2: #f3fbff;
  --grass: #8fd16b;
  --grass-dark: #6fb34c;
  --wool: #fffdf5;
  --skin: #ffe0bd;
  --ink: #5a4632;
  --accent: #ffb74d;
  --accent-dark: #f59a23;
}

html, body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 70%, #eaf8d8 100%);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 24px;
  -webkit-font-smoothing: antialiased;
}

/* 标题 */
.site-header {
  text-align: center;
  margin-top: 8px;
}
.site-header h1 {
  font-size: clamp(28px, 6vw, 40px);
  letter-spacing: 4px;
  color: var(--ink);
  text-shadow: 0 2px 0 #fff;
}
.subtitle {
  margin-top: 6px;
  font-size: 15px;
  color: #7a6650;
}

/* 舞台 */
.stage-wrap {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.stage {
  position: relative;
  width: 100%;
  height: clamp(260px, 56vw, 340px);
  border-radius: 28px;
  background: linear-gradient(180deg, #e3f6ff 0%, #f7fdf1 100%);
  box-shadow: 0 10px 30px rgba(90, 70, 50, 0.15), inset 0 -6px 0 rgba(0,0,0,0.03);
  overflow: hidden;
  user-select: none;
}

.ground {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 26%;
  background: linear-gradient(180deg, var(--grass) 0%, var(--grass-dark) 100%);
  border-radius: 50% 50% 0 0 / 30px 30px 0 0;
}

/* 小羊整体 */
.sheep {
  position: absolute;
  left: 50%;
  bottom: 22%;
  width: 170px;
  height: 150px;
  transform: translateX(-50%);
  cursor: pointer;
  transition: transform 0.4s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  animation: breathe 3.6s ease-in-out infinite;
}
.sheep:focus-visible { filter: drop-shadow(0 0 6px var(--accent)); }

.sheep.sleep { animation: snooze 4.2s ease-in-out infinite; }
.sheep.bounce { animation: bounce 0.6s ease; }
.sheep.wiggle { animation: wiggle 0.6s ease; }

.body {
  position: absolute;
  left: 22px;
  top: 30px;
  width: 128px;
  height: 92px;
  background: var(--wool);
  border-radius: 56px;
  box-shadow: inset -6px -8px 0 rgba(0,0,0,0.04), 0 4px 0 rgba(0,0,0,0.05);
  overflow: hidden;
}
.wool {
  position: absolute;
  inset: -6px;
  background:
    radial-gradient(circle at 20% 30%, #fff 18px, transparent 19px),
    radial-gradient(circle at 60% 20%, #fff 20px, transparent 21px),
    radial-gradient(circle at 85% 50%, #fff 18px, transparent 19px),
    radial-gradient(circle at 40% 70%, #fff 20px, transparent 21px);
  opacity: 0.7;
}

/* 脸 */
.face {
  position: absolute;
  left: 50%;
  top: 46px;
  transform: translateX(-50%);
  width: 60px;
  height: 40px;
  background: var(--skin);
  border-radius: 40px 40px 34px 34px;
  z-index: 2;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.05);
}
.eyes {
  position: absolute;
  top: 12px;
  left: 0; right: 0;
  display: flex;
  justify-content: space-around;
  padding: 0 10px;
}
.eye {
  position: relative;
  width: 10px;
  height: 4px;
  border-bottom: 3px solid var(--ink);
  border-radius: 0 0 10px 10px;
}
.mouth {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 10px;
  height: 6px;
  transform: translateX(-50%);
  border-bottom: 2.5px solid var(--ink);
  border-radius: 0 0 10px 10px;
}
.mouth.open {
  width: 12px; height: 10px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: #ffb3b3;
}
.mouth.smile {
  width: 14px; height: 8px;
  border-bottom: 2.5px solid var(--ink);
  border-radius: 0 0 14px 14px;
}

/* 耳朵、角 */
.ear {
  position: absolute;
  top: 46px;
  width: 36px;
  height: 22px;
  background: var(--skin);
  border-radius: 50%;
  z-index: 1;
}
.ear-l { left: 4px; transform: rotate(-25deg); }
.ear-r { right: 4px; transform: rotate(25deg); }

.horn {
  position: absolute;
  top: 20px;
  width: 18px;
  height: 30px;
  background: #e8d7b0;
  border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
  z-index: 0;
}
.horn-l { left: 40px; transform: rotate(-20deg); }
.horn-r { right: 40px; transform: rotate(20deg); }

/* 腿 */
.leg {
  position: absolute;
  bottom: 0;
  width: 14px;
  height: 30px;
  background: #e8d7b0;
  border-radius: 0 0 8px 8px;
  z-index: 0;
}
.leg-1 { left: 40px; }
.leg-2 { left: 58px; }
.leg-3 { right: 58px; }
.leg-4 { right: 40px; }

/* 睡觉时闭眼、眼睛变弧线 */
.sheep.sleep .eye {
  border-bottom: none;
  border-top: 3px solid var(--ink);
  border-radius: 10px 10px 0 0;
  height: 6px;
}

/* 睡觉 Z */
.zzz {
  position: absolute;
  right: 16%;
  top: 22%;
  display: flex;
  gap: 4px;
  font-weight: 700;
  color: #6a5ad6;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.zzz span {
  display: inline-block;
  animation: float 2.4s ease-in-out infinite;
}
.zzz span:nth-child(1) { font-size: 18px; }
.zzz span:nth-child(2) { font-size: 24px; animation-delay: 0.4s; }
.zzz span:nth-child(3) { font-size: 30px; animation-delay: 0.8s; }
.zzz.show { opacity: 1; }

/* 草 */
.grass {
  position: absolute;
  left: 0; right: 0;
  bottom: 22%;
  height: 0;
  pointer-events: none;
}
.grass .blade {
  position: absolute;
  bottom: 0;
  font-size: 22px;
  animation: pop 0.5s ease;
}

.feed-grass {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 22px;
  pointer-events: none;
}

/* 懒惰值 */
.meter {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  font-size: 14px;
}
.meter-label { white-space: nowrap; }
.meter-bar {
  flex: 1;
  height: 12px;
  background: rgba(255,255,255,0.7);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.meter-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ffd27a, var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.meter-num {
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 台词 */
.speech {
  min-height: 48px;
  max-width: 440px;
  padding: 12px 16px;
  text-align: center;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(90, 70, 50, 0.12);
  font-size: 16px;
  line-height: 1.5;
  position: relative;
  animation: fadeIn 0.4s ease;
}

/* 按钮 */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  padding: 10px 18px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #ffc56b, var(--accent-dark));
  box-shadow: 0 4px 0 #d9811a, 0 8px 16px rgba(217, 129, 26, 0.25);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.05); }
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d9811a, 0 4px 10px rgba(217, 129, 26, 0.25);
}
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.btn-ghost {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 0 #e6d9c4, 0 8px 16px rgba(90, 70, 50, 0.12);
}
.btn-ghost:active { box-shadow: 0 1px 0 #e6d9c4; }

/* 说明 */
.info {
  width: 100%;
  max-width: 520px;
  margin-top: 28px;
  padding: 18px 20px;
  background: rgba(255,255,255,0.7);
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.7;
}
.info h2 {
  font-size: 17px;
  margin-bottom: 6px;
}
.info p + p { margin-top: 8px; }
.info a {
  color: var(--accent-dark);
  font-weight: 600;
}

.site-footer {
  margin-top: 20px;
  font-size: 13px;
  color: #7a6650;
  text-align: center;
}

/* 动画 */
@keyframes breathe {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}
@keyframes snooze {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-2deg); }
  50% { transform: translateX(-50%) translateY(2px) rotate(2deg); }
}
@keyframes bounce {
  0% { transform: translateX(-50%) translateY(0); }
  30% { transform: translateX(-50%) translateY(-28px) rotate(-4deg); }
  60% { transform: translateX(-50%) translateY(0) rotate(3deg); }
  80% { transform: translateX(-50%) translateY(-6px); }
  100% { transform: translateX(-50%) translateY(0); }
}
@keyframes wiggle {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  25% { transform: translateX(-50%) rotate(-6deg); }
  75% { transform: translateX(-50%) rotate(6deg); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

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