:root {
  --bg: #1b1420;
  --ink: #fff8ef;
  --muted: #c9b9c4;
  --accent: #ffb547;
  --card: #2a2030;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); 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: var(--bg); }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.home { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.35); color: var(--ink); text-decoration: none; display: grid; place-items: center; font-size: 22px; line-height: 1; z-index: 3; }
.score { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 34px); left: 0; right: 0; text-align: center; font-size: 56px; font-weight: 900; text-shadow: 0 4px 0 rgba(0,0,0,.4); pointer-events: none; font-variant-numeric: tabular-nums; z-index: 2; }
.toast { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: rgba(0,0,0,.7); font-weight: 800; white-space: nowrap; opacity: 0; pointer-events: none; z-index: 2; }
.toast.show { animation: toast 2s ease-out; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 12%, 78% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

.panel { position: absolute; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); display: none; text-align: center; padding: 22px 18px; border-radius: 24px; background: rgba(42,32,48,.96); box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 5; }
.panel.show { display: block; }
.panel h1, .panel h2 { margin: 0 0 6px; color: var(--accent); letter-spacing: 3px; }
.panel h1 { font-size: 30px; }
.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: 2px 0; font-variant-numeric: tabular-nums; }
.best { color: var(--accent) !important; min-height: 1.2em; }
.pets { list-style: none; margin: 12px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pets button { width: 100%; padding: 0; background: none; font-size: 10px; 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 #b86b12; }
.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #b86b12; }
.ghost { background: rgba(255,255,255,.1); }

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