* { box-sizing: border-box; }

:root {
  --sea-1: #bfe9f7;
  --sea-2: #6fc3e6;
  --sea-3: #2f7fb8;
  --ink: #1d3b52;
  --whale: #5b8fd6;
  --whale-dark: #3a6bb3;
  --belly: #e9f6ff;
  --accent: #ff8fa3;
}

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(--sea-1) 0%, var(--sea-2) 55%, var(--sea-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(20, 60, 100, 0.25);
}

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

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

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

.bubbles i {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.15);
  animation: rise linear forwards;
}

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

.whale {
  position: absolute;
  left: 20%;
  top: 40%;
  width: clamp(160px, 30vw, 240px);
  cursor: pointer;
  outline: none;
  transition: transform 0.6s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

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

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

.whale .body {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 12px rgba(20, 60, 100, 0.25));
  animation: bob 3s ease-in-out infinite;
}

.whale .shape { fill: var(--whale); }
.whale .tail { fill: var(--whale-dark); transform-origin: 168px 60px; animation: wag 1.2s ease-in-out infinite; }
.whale .fin { fill: var(--whale-dark); }
.whale .belly { fill: var(--belly); }
.whale .eye circle:first-of-type { fill: #1d3b52; }
.whale .eye .shine { fill: #fff; }
.whale .lid { fill: var(--whale); }
.whale .cheek { fill: var(--accent); opacity: 0.6; }
.whale .mouth { fill: none; stroke: #1d3b52; stroke-width: 3; stroke-linecap: round; }

.whale .eye { transform-origin: 56px 48px; animation: blink 4.5s infinite; }

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

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

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

/* 状态：开心时挥动尾巴更快，困了闭眼 */
.whale.happy .body { animation-duration: 1.4s; }
.whale.happy .tail { animation-duration: 0.5s; }
.whale.sleepy .eye { animation: none; }
.whale.sleepy .lid { display: none; }
.whale.sleepy .eye circle { opacity: 0; }
.whale.sleepy .body { animation-duration: 5s; }
.whale.sleepy .mouth { d: path("M28 66 Q40 68 54 66"); }

/* 喷水 */
.spout {
  position: absolute;
  left: 50%;
  top: -36px;
  width: 40px;
  height: 50px;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
}

.spout span {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
}

.whale.spouting .spout { animation: spout 1s ease-out; }
.whale.spouting .spout span:nth-child(1) { animation: drop1 1s ease-out; }
.whale.spouting .spout span:nth-child(2) { animation: drop2 1s ease-out; }
.whale.spouting .spout span:nth-child(3) { animation: drop3 1s ease-out; }

@keyframes spout { 0%, 100% { opacity: 0; } 15%, 70% { opacity: 1; } }
@keyframes drop1 { from { transform: translate(0,0); } to { transform: translate(-22px,-34px); } }
@keyframes drop2 { from { transform: translate(0,0); } to { transform: translate(0,-46px); } }
@keyframes drop3 { from { transform: translate(0,0); } to { transform: translate(22px,-34px); } }

/* 爱心 */
.heart {
  position: absolute;
  left: 50%;
  top: 10%;
  font-size: 28px;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
}

.whale.loved .heart { animation: float 1.4s ease-out forwards; }

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

.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: #eef8fd;
  border: 2px solid #cbe8f6;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}

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

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

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

.foot p { margin: 4px 0; }

.foot a {
  color: var(--whale-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;
  }
}
