* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; overflow: hidden;
  font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: linear-gradient(180deg, #a5d8ff 0%, #e7f5ff 72%, #94d82d 72%, #74b816 100%);
}
.back { position: fixed; top: 12px; left: 12px; z-index: 5; background: #fff; border-radius: 999px; padding: 6px 14px; text-decoration: none; color: #333; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.hud { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 5; }
.pill { background: #fff; border-radius: 999px; padding: 6px 16px; font-weight: bold; box-shadow: 0 2px 8px rgba(0,0,0,.15); border: 0; font-size: 1rem; font-family: inherit; }
.pill.on { background: #ffd43b; }
#muteBtn { cursor: pointer; }

.stage { position: relative; width: 100vw; height: 100vh; }
#field { position: absolute; inset: 0; }

.ball { position: absolute; top: 0; left: 0; width: 84px; height: 84px; margin-left: -42px; font-size: 64px; line-height: 84px; text-align: center; will-change: transform; filter: drop-shadow(0 6px 6px rgba(0,0,0,.25)); }
.ball.eaten { opacity: 0; transition: opacity .25s; }
.ball.missed { opacity: .35; transition: opacity .6s; }

.hippo { position: absolute; bottom: 3%; left: 50%; width: 240px; height: 230px; margin-left: -120px; transition: left .35s ease-out; z-index: 1; }
.hippo svg { width: 100%; height: 100%; overflow: visible; }
#field { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#mouth { transform-box: fill-box; transform-origin: center; transform: scaleY(.04); transition: transform .12s; }
.hippo.open #mouth { transform: scaleY(1); }
.hippo.open #smile { opacity: 0; }
.hippo.chew { animation: chew .4s; }
@keyframes chew { 25% { transform: translateY(6px) scaleY(.94); } 60% { transform: translateY(-8px); } }
.bubble { position: absolute; left: 50%; top: -34px; transform: translateX(-50%); background: #fff; border-radius: 999px; padding: 2px 14px; font-size: 1.3rem; font-weight: bold; box-shadow: 0 2px 8px rgba(0,0,0,.2); white-space: nowrap; }
.bubble:empty { display: none; }

.cam {
  position: absolute; right: 16px; top: 60px; width: 200px; height: 150px;
  border-radius: 12px; overflow: hidden; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.3); background: #000;
}
.cam video, .cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

.dialog { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 10; }
.dialog.hidden { display: none; }
.box { background: #fff; border-radius: 20px; padding: 28px 36px; text-align: center; max-width: 440px; line-height: 1.6; }
.box h2 { margin-top: 0; }
.box button { font-size: 1.1rem; padding: 10px 32px; border: 0; border-radius: 999px; background: #ff6b6b; color: #fff; font-weight: bold; cursor: pointer; }
.box button:disabled { background: #bbb; cursor: default; }
.btns { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.box button.btn-sub { background: #868e96; font-size: 1rem; padding: 8px 28px; }
.settings { display: flex; flex-direction: column; gap: 10px; margin: 0 0 18px; text-align: left; }
.opt { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 2px solid #dee2e6; border-radius: 12px; cursor: pointer; }
.opt:has(input[type=radio]:checked) { border-color: #ff6b6b; background: #fff5f5; }
.settings label:not(.opt) { padding: 8px 12px; border: 2px solid #dee2e6; border-radius: 12px; }
.settings input[type=number] { width: 4.2em; font-size: 1rem; padding: 2px 6px; border: 1px solid #adb5bd; border-radius: 6px; text-align: center; }
