:root {
  --sky-top: #fbeee0;
  --sky-bottom: #e9d6e8;
  --ink: #3a2a3a;
  --muted: #7d6a7a;
  --accent: #ffb547;
  --panel: rgba(255, 252, 248, .94);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--sky-top); color: var(--ink); overflow: hidden; }
body { font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }

#app { position: relative; height: 100%; max-width: 480px; margin: 0 auto; user-select: none; -webkit-user-select: none; background: linear-gradient(var(--sky-top), var(--sky-bottom)); }
#world { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 14px 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.home { width: 34px; height: 34px; border-radius: 50%; background: rgba(58,42,58,.1); color: var(--ink); text-decoration: none; display: grid; place-items: center; font-size: 22px; line-height: 1; }
.score { flex: 1; font-size: 44px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.best { text-align: right; }
.best small { display: block; font-size: 11px; color: var(--muted); }
.best b { font-size: 16px; color: #c47a12; }
.combo { position: absolute; left: 0; right: 0; top: 22%; text-align: center; font-size: 26px; font-weight: 900; color: #e0457b; opacity: 0; pointer-events: none; text-shadow: 0 2px 0 #fff; }
.combo.show { animation: pop 1s ease-out; }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.12); } 70% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-16px); } }

.panel { position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); display: none; text-align: center; padding: 22px 18px; border-radius: 24px; background: var(--panel); box-shadow: 0 10px 30px rgba(58,42,58,.18); }
.panel.show { display: block; }
.panel h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: 3px; color: #e08a10; }
.panel h2 { margin: 0; color: #e08a10; }
.panel p { margin: 6px 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.panel .big { font-size: 52px; font-weight: 900; color: var(--ink); margin: 4px 0; font-variant-numeric: tabular-nums; }
.pets { list-style: none; margin: 14px 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pets button { width: 100%; padding: 0; background: none; text-align: center; font-size: 11px; color: var(--muted); }
.pets canvas { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; margin-bottom: 2px; transition: transform .15s; }
.pets button.on canvas { box-shadow: 0 0 0 3px var(--accent); transform: scale(1.06); }
.pets button.on { color: var(--ink); font-weight: 800; }
.primary, .ghost { display: block; width: 100%; margin-top: 10px; padding: 13px; border-radius: 999px; font-weight: 800; font-size: 17px; }
.primary { background: var(--accent); color: #3b1d05; box-shadow: 0 4px 0 #c47a12; }
.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #c47a12; }
.ghost { background: rgba(58,42,58,.08); }

.loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--sky-top); z-index: 6; }
.loading.hide { display: none; }
