:root {
  --text: #f4efe9;
  --muted: #b3aca4;
  --accent: #f0b35a;
  --panel: rgba(28, 26, 24, 0.94);
  --chip: rgba(255, 255, 255, 0.12);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--text); overflow: hidden;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

#app { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }

/* 视频画面按原始比例铺满，饭盆按百分比定位，所以舞台必须和视频同比例 */
#stage { position: relative; aspect-ratio: 830 / 1108; height: min(100dvh, calc(100vw * 1108 / 830));
  touch-action: none; user-select: none; -webkit-user-select: none; }
#stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#v-act { opacity: 0; transition: opacity .28s ease; }
#v-act.show { opacity: 1; }
#v-act.fade-out { transition-duration: .45s; }
#v-idle { transition: filter 1s; }
.mode-sleepy #v-idle { filter: brightness(.55) saturate(.8); }

#bowl { position: absolute; display: none; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%); mask-image: linear-gradient(to bottom, transparent 0, #000 22%); }
#bowl.drop { display: block; animation: drop .5s cubic-bezier(.3, 1.4, .6, 1) both; }
@keyframes drop { from { transform: translateY(-140%); opacity: 0; } 40% { opacity: 1; } to { transform: none; opacity: 1; } }

#night { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1s;
  background: radial-gradient(ellipse at 50% 30%, transparent 30%, rgba(10, 12, 40, .55)); }
.mode-sleepy #night { opacity: 1; }

#fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.heart { position: absolute; font-size: 26px; animation: float 1.2s ease-out forwards; }
.zzz { position: absolute; left: 62%; top: 18%; font-size: 22px; color: #cfd6ff; animation: zzz 3s ease-out forwards; }
@keyframes float { to { transform: translateY(-90px) scale(1.4); opacity: 0; } }
@keyframes zzz { from { opacity: 0; transform: translate(0, 0); } 20% { opacity: 1; } to { opacity: 0; transform: translate(40px, -80px) scale(1.5); } }

#top { position: absolute; top: 0; left: 0; right: 0; padding: calc(env(safe-area-inset-top) + 14px) 16px 28px;
  text-align: center; background: linear-gradient(rgba(0, 0, 0, .7), transparent); pointer-events: none; }
#pet-name { font-size: 22px; font-weight: 600; letter-spacing: 2px; }
#status { margin-top: 4px; font-size: 15px; color: var(--muted); }
#preload { margin-top: 4px; font-size: 12px; color: var(--muted); }
#reason { margin-top: 6px; font-size: 14px; color: var(--accent); min-height: 1.2em; transition: opacity .3s; }
.mode-hungry #status { color: var(--accent); }

#toast { position: absolute; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 8px 14px; border-radius: 18px; background: rgba(0, 0, 0, .6); font-size: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
#toast { top: 40%; }

#cam-box { position: absolute; right: 12px; top: calc(env(safe-area-inset-top) + 90px); width: 96px; border-radius: 12px;
  overflow: hidden; background: #111; border: 1px solid rgba(255, 255, 255, .15); }
#cam { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transform: scaleX(-1); }
#cam-label { font-size: 11px; text-align: center; padding: 3px 2px; color: var(--muted); }
#cam-label.hit { color: #9be59b; }

#bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: flex-end; gap: 22px;
  padding: 24px 16px calc(env(safe-area-inset-bottom) + 18px); background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.round { position: relative; width: 58px; height: 58px; border-radius: 50%; background: var(--chip);
  display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.round .icon { font-size: 22px; line-height: 1; }
.round small { font-size: 11px; color: var(--muted); margin-top: 3px; }
.round.big { width: 72px; height: 72px; }
.round.big .icon { font-size: 28px; }
.round.small { width: 44px; height: 44px; }
.round.off { opacity: .45; }
.round.on { background: rgba(240, 179, 90, .28); }
.ring { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #9be59b; opacity: 0; transition: transform .08s, opacity .2s; }
.mode-hungry #btn-feed { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(240, 179, 90, .25); background: rgba(240, 179, 90, .35); } }

#panel { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); max-width: 460px; margin: 0 auto;
  max-height: 80dvh; overflow: auto; padding: 16px 18px; border-radius: 16px; background: var(--panel); font-size: 14px; z-index: 5; }
#panel h3 { margin: 4px 0 8px; font-size: 15px; }
#panel .hints { margin: 0 0 14px; padding-left: 0; list-style: none; line-height: 1.9; }
#panel select { font: inherit; margin-left: 6px; padding: 4px 6px; border-radius: 8px; }
#panel .note { color: var(--muted); font-size: 12px; line-height: 1.6; }
button.text { color: var(--accent); padding: 6px 0; margin-right: 16px; }

#start { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: #000; z-index: 10; }
#start-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .55; }
.start-inner { position: relative; width: 100%; padding: 24px 16px calc(env(safe-area-inset-bottom) + 40px); text-align: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, .9) 35%); }
.start-inner h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: 2px; }
#btn-start { margin-top: 14px; padding: 14px 44px; border-radius: 28px; background: var(--accent); color: #221a10; font-size: 18px; font-weight: 600; }
#btn-start:disabled { opacity: .4; }
.start-inner .note { color: var(--muted); font-size: 12px; margin-top: 12px; }
[hidden] { display: none !important; }
