/* Кот: спрайт эмоции под 3D-холстом. Спрайт виден, пока 3D не загрузился или выключен. */
.mascot { position: relative; display: inline-block; flex: none; }
.mascot-sprite { position: absolute; inset: 0; background: var(--cat-img) center bottom / contain no-repeat; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mascot-sprite { background-image: var(--cat-img-dark); } }
:root[data-theme="dark"] .mascot-sprite { background-image: var(--cat-img-dark); }
.mascot .m3d-gl { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.mascot.m3d-on .mascot-sprite { visibility: hidden; }

/* ---------- кот на экране (js/mascot/stage.js): слой над таб-баром (25), под правой панелью (39–41), листами и модалками */
:root { --dust: rgba(128,116,98,.55); --dust-hi: rgba(255,255,255,.9); --dust-line: rgba(110,100,86,.55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --dust: rgba(205,212,222,.32); --dust-hi: rgba(255,255,255,.55); --dust-line: rgba(205,212,222,.35); } }
:root[data-theme="dark"] { --dust: rgba(205,212,222,.32); --dust-hi: rgba(255,255,255,.55); --dust-line: rgba(205,212,222,.35); }

.cat-stage { position: fixed; inset: 0; z-index: 35; pointer-events: none; overflow: hidden; }
.cat { position: absolute; left: 0; top: 0; width: 72px; height: 64px; padding: 0; border: 0; background: none; pointer-events: auto; will-change: transform; overflow: visible;
  touch-action: none; -webkit-user-select: none; user-select: none; cursor: grab; -webkit-tap-highlight-color: transparent; }
.cat[hidden] { display: none; }
.cat:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 14px; }
.cat::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 7px; border-radius: 50%; background: rgba(0,0,0,.18); filter: blur(2px); transition: opacity .15s, transform .15s; }
.cat.air::after { opacity: 0; transform: scale(.4); }
.cat.held { cursor: grabbing; z-index: 2; }
.cat.held::after { opacity: .5; transform: translateY(8px) scale(.7); }
.cat.hover::after { opacity: .35; transform: scale(.75); }
.cat .cat-face { display: block; width: 72px; height: 64px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.18)); }

.m-hop { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; transition: transform .14s ease; }
.m-hop.crouch { transform: translateY(5px) scale(1.14,.8); transition: transform .16s cubic-bezier(.3,0,.6,1); }
.m-hop.fly { transform: rotate(var(--tilt,0deg)) scale(.95,1.07); transition: transform .1s; }
.cat.held .m-hop { transform: rotate(var(--tilt,0deg)) scale(1.1); transition: transform .08s; }
.cat.hover .m-hop { transform: translateY(-2px); }
.m-hop.land { animation: m-land .42s cubic-bezier(.3,1.5,.5,1); }
.m-hop.bounce { animation: m-bounce .52s ease-in-out var(--n,1); }
.cat.shake .cat-face { animation: m-shake .5s; }
@keyframes m-land { 0% { transform: scale(1.24,.72); } 38% { transform: scale(.9,1.12); } 68% { transform: scale(1.05,.96); } 100% { transform: none; } }
@keyframes m-bounce { 0%, 100% { transform: none; } 22% { transform: scale(1.08,.92); } 55% { transform: translateY(-13px) scale(.96,1.05); } 82% { transform: scale(1.04,.96); } }
@keyframes m-shake { 20% { transform: translateX(-4px) rotate(-4deg); } 40% { transform: translateX(4px) rotate(4deg); } 60% { transform: translateX(-3px) rotate(-2deg); } 80% { transform: translateX(2px); } }

/* кольцо «нажми меня» до первого нажатия */
.m-ring { position: absolute; left: 10px; right: 10px; top: 8px; bottom: 0; border-radius: 50%; pointer-events: none; opacity: 0; border: 2.5px solid var(--accent); }
.cat.call .m-ring { animation: m-ring 1.8s ease-out infinite; }
@keyframes m-ring { 0% { opacity: .85; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.35); } }

/* знак над головой */
.m-sign { position: absolute; left: 50%; top: -30px; width: 32px; height: 32px; margin-left: -16px; border-radius: 50%; display: grid; place-items: center; pointer-events: none; z-index: 2;
  animation: m-sign-in .38s cubic-bezier(.2,1.6,.4,1), m-sign-bob 1.6s ease-in-out .4s infinite; }
.m-sign.out { animation: m-sign-out .26s ease-in forwards; }
@keyframes m-sign-in { from { transform: translateY(10px) scale(.2); opacity: 0; } }
@keyframes m-sign-bob { 50% { transform: translateY(-4px); } }
@keyframes m-sign-out { to { transform: translateY(-12px) scale(.5); opacity: 0; } }

/* облачко с репликой */
.m-bubble { position: absolute; z-index: 3; display: flex; gap: 8px; align-items: center; max-width: 250px; padding: 9px 13px; border: 0; border-radius: 18px 18px 18px 6px;
  font: inherit; font-size: 13.5px; line-height: 1.35; text-align: left; color: var(--fg); pointer-events: auto; cursor: pointer; animation: m-pop .3s cubic-bezier(.2,.9,.3,1.3); }
.m-bubble[hidden] { display: none; }
.m-bubble.r { border-radius: 18px 18px 6px 18px; }
.m-bubble .mb-i { flex: none; display: grid; place-items: center; }
@keyframes m-pop { from { opacity: 0; transform: translateY(6px) scale(.9); } }

/* пыль при прыжке и приземлении */
.dust { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; }
.dust i { position: absolute; left: 0; top: 0; border-radius: 50%; box-shadow: inset -2px -3px 0 rgba(0,0,0,.06); background: radial-gradient(circle at 34% 32%, var(--dust-hi), var(--dust) 62%);
  opacity: 0; animation: m-puff .62s cubic-bezier(.2,.7,.3,1) forwards; }
.dust b { position: absolute; left: -7px; top: -6px; width: 14px; height: 3px; border-radius: 2px; background: var(--dust-line); opacity: 0; animation: m-speed .42s ease-out forwards; }
@keyframes m-puff { 0% { opacity: .95; transform: translate(calc(-50% + var(--dx) * .35), -50%) scale(.45); } 45% { opacity: .85; } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.25); } }
@keyframes m-speed { 0% { opacity: .9; transform: translateX(calc(var(--side) * 20px)) scaleX(.3); } 100% { opacity: 0; transform: translateX(calc(var(--side) * 46px)) scaleX(1); } }

/* закрытая задача: сердечко-шарик улетает вверх */
.m-balloon { position: absolute; z-index: 4; width: 34px; height: 52px; margin: -26px 0 0 -17px; pointer-events: none; transform-origin: 50% 100%; animation: m-balloon-up 2.8s cubic-bezier(.42,0,.6,1) forwards; }
.m-balloon i { display: block; width: 34px; height: 34px; animation: m-balloon-sway 1.1s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.m-balloon svg { width: 34px; height: 34px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.18)); }
.m-balloon::after { content: ""; position: absolute; left: 50%; top: 30px; width: 1.2px; height: 20px; margin-left: -.6px; border-radius: 1px; background: linear-gradient(var(--fg3), transparent); opacity: .8; }
@keyframes m-balloon-up { 0% { transform: translate(0,0) scale(.35); opacity: 0; } 7% { opacity: 1; transform: translate(0,-2px) scale(.9); } 22% { transform: translate(0,-14px) scale(1.5); } 92% { opacity: 1; }
  100% { transform: translate(var(--sx,16px), var(--ty,-400px)) scale(4.6); opacity: 0; } }
@keyframes m-balloon-sway { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }

@media (prefers-reduced-motion: reduce) {
  .cat.call .m-ring, .m-sign, .m-hop.bounce, .m-hop.land, .cat.shake .cat-face, .m-balloon i { animation: none; }
  .m-balloon { animation-duration: 1.1s; }
}

/* страница замеров /kit/cat */
.catlab { display: grid; gap: 22px; max-width: 820px; }
.catlab-stage { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; padding: 18px; border-radius: 16px; background: var(--surface2); }
.catlab-stage figure { margin: 0; display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--fg3); }
.emo { display: flex; flex-wrap: wrap; gap: 6px; }
.emo button { height: 28px; padding: 0 10px; border-radius: 8px; font-size: 12px; color: var(--fg2); box-shadow: inset 0 0 0 1px var(--sep); }
.emo button.on { color: var(--accent); background: var(--accent-soft); box-shadow: none; }
.metrics { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.metrics th, .metrics td { text-align: left; padding: 6px 10px; border-top: 1px solid var(--sep2); vertical-align: top; }
.metrics th { color: var(--fg3); font-weight: 500; width: 46%; }
.metrics-wrap { overflow-x: auto; border-radius: 12px; box-shadow: 0 0 0 1px var(--sep); }
