* { box-sizing: border-box; }

:root {
  --sky-1: #e6f4fc;
  --sky-2: #b9dff5;
  --sky-3: #7fb8e4;
  --ink: #23405c;
  --hair: #5fa3e0;
  --hair-dark: #3f7fc4;
  --skin: #ffe4d6;
  --dress: #34405e;
  --dress-light: #4a5a7d;
  --accent: #ff8fb1;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-3) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.top {
  text-align: center;
  padding: 24px 16px 4px;
  width: 100%;
}

.top h1 {
  margin: 0;
  font-size: clamp(22px, 5vw, 30px);
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(30, 70, 110, 0.25);
}

.sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
}

.stage {
  position: relative;
  width: 100%;
  max-width: 720px;
  flex: 1;
  min-height: 340px;
  margin: 12px auto 0;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.45), rgba(255,255,255,0) 60%);
}

.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparkles i {
  position: absolute;
  bottom: -20px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.8;
  animation: rise linear forwards;
}

@keyframes rise {
  to { transform: translateY(-120vh); opacity: 0; }
}

.maid {
  position: absolute;
  left: 20%;
  top: 30%;
  width: clamp(150px, 28vw, 220px);
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.maid:focus-visible { filter: drop-shadow(0 0 6px #fff); }

.maid.flip { transform: scaleX(-1); }

.maid .body {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 10px 12px rgba(30, 70, 110, 0.25));
  animation: bob 2.6s ease-in-out infinite;
}

.maid .hair-back,
.maid .hair-front { fill: var(--hair); }
.maid .hair-front { stroke: var(--hair-dark); stroke-width: 0.6; }
.maid .hair-back { fill: var(--hair-dark); }
.maid .face { fill: var(--skin); }
.maid .dress { fill: var(--dress); }
.maid .top-dress { fill: var(--dress-light); }
.maid .legs { fill: #f3e6e0; }
.maid .shoe { fill: #2a2f44; }
.maid .apron { fill: #fff; }
.maid .apron-tie { fill: #ffffff; opacity: 0.9; }
.maid .arm path { fill: var(--dress-light); }
.maid .hand { fill: var(--skin); }
.maid .headband { fill: #fff; }
.maid .bow { fill: var(--accent); }
.maid .iris { fill: #2e5f9a; }
.maid .shine { fill: #fff; }
.maid .lid { fill: var(--hair); }
.maid .blush { fill: #ff6f91; opacity: 0.75; }
.maid .tail { fill: #5b8fd6; stroke: #3a6bb3; stroke-width: 0.8; }
.maid .lace { fill: #fff; }
.maid .lace-band { fill: #fff; stroke: #d8ecfb; stroke-width: 0.8; }
.maid .apron-whale path { fill: #5b8fd6; }
.maid .whale-eye { fill: #fff; }
.maid .tail-g { transform-origin: 70px 200px; animation: wag 1.6s ease-in-out infinite; }

@keyframes wag {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-8deg); }
}
.maid .mouth { fill: none; stroke: #7a4a4a; stroke-width: 2.2; stroke-linecap: round; }

.maid .arm-l { transform-origin: 74px 116px; animation: sway 3.2s ease-in-out infinite; }
.maid .arm-r { transform-origin: 126px 116px; animation: sway 3.2s ease-in-out infinite reverse; }

.maid .eye { transform-origin: center; animation: blink 4.8s infinite; }
.maid .eye .lid { display: none; }
.maid .zzz {
  position: absolute;
  right: -8px;
  top: 6%;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 6px rgba(30,70,110,0.3);
  opacity: 0;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-7px) rotate(0.6deg); }
}

@keyframes sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-6deg); }
}

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

/* 开心：动得更快 */
.maid.happy .body { animation-duration: 1.2s; }
.maid.happy .arm { animation-duration: 1.2s; }

/* 睡觉：闭眼、慢呼吸、冒 ZZZ */
.maid.sleepy .body { animation-duration: 5s; }
.maid.sleepy .eye .iris,
.maid.sleepy .eye .shine { opacity: 0; }
.maid.sleepy .eye .lid { display: block; }
.maid.sleepy .eye { animation: none; }
.maid.sleepy .mouth { d: path("M93 102 Q100 104 107 102"); }
.maid.sleepy .zzz { animation: zzz 2.8s ease-in-out infinite; }

@keyframes zzz {
  0% { opacity: 0; transform: translate(0, 10px); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translate(14px, -36px); }
}

/* 点击后的爱心 */
.fx-heart,
.fx-note {
  position: absolute;
  left: 50%;
  top: 4%;
  font-size: 28px;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
}

.fx-note { color: #fff; left: 70%; top: 14%; font-size: 24px; }

.maid.loved .fx-heart { animation: float 1.4s ease-out forwards; }
.maid.loved .fx-note { animation: float 1.4s ease-out 0.25s forwards; }

@keyframes float {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-60px) scale(1.2); }
}

/* 喝茶（喂食）：身体轻轻前后晃一下 */
.maid.tea .body { animation: tea 1.2s ease-in-out; }
@keyframes tea {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-4deg) translateY(-4px); }
  60% { transform: rotate(3deg); }
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: opacity 0.4s;
}

.panel {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 16px 16px 8px;
  background: #fff;
}

.panel button {
  flex: 1 1 140px;
  max-width: 220px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #eef6fd;
  border: 2px solid #cfe5f7;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}

.panel button:hover { background: #ddeefb; }
.panel button:active { transform: scale(0.96); }
.panel button:focus-visible { outline: 3px solid var(--sky-3); outline-offset: 2px; }

.mood {
  width: 100%;
  text-align: center;
  font-size: 14px;
  color: #4d6d89;
  margin-top: 2px;
}

.foot {
  width: 100%;
  max-width: 720px;
  padding: 12px 16px 24px;
  background: #fff;
  text-align: center;
  font-size: 13px;
  color: #5b7389;
  line-height: 1.7;
}

.foot p { margin: 4px 0; }

.foot a {
  color: var(--hair-dark);
  text-decoration: none;
}

.foot a:hover { text-decoration: underline; }

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