.pet{position:fixed;right:18px;bottom:18px;z-index:40;display:flex;flex-direction:column;align-items:flex-end;gap:6px;width:max-content;max-width:min(320px,calc(100vw - 24px));touch-action:none;user-select:none}
.pet[hidden],.pet-chip[hidden]{display:none!important}
.pet[data-side=left]{align-items:flex-start}
.pet[data-vertical=down]{flex-direction:column-reverse}
.pet-body{padding:0;border:0;background:none;cursor:grab;line-height:0;border-radius:50%;filter:drop-shadow(0 8px 14px #6a3d3a30)}
.pet.dragging .pet-body{cursor:grabbing}
.pet-body:focus-visible{outline:3px solid #56bdb2;outline-offset:4px}
.pet-hide{position:absolute;top:-4px;right:-4px;width:22px;height:22px;border-radius:50%;background:#fff;border:1px solid var(--line);color:var(--muted);font-size:14px;line-height:1;opacity:0;transition:opacity .15s;padding:0}
.pet:hover .pet-hide,.pet:focus-within .pet-hide{opacity:1}
.pet-chip{position:fixed;right:18px;bottom:18px;z-index:40;width:42px;height:42px;border-radius:50%;background:#fff;border:1px solid var(--line);box-shadow:0 6px 18px #24464820;font-size:19px;padding:0}
.pet-bubble{background:#fff;border:1px solid var(--line);border-radius:14px;padding:9px 13px;font-size:13px;line-height:1.35;color:var(--ink);box-shadow:0 8px 24px #24464818;max-width:250px;position:relative}
.pet-panel{background:#fff;border:1px solid var(--line);border-radius:16px;padding:14px 16px;box-shadow:0 14px 40px #2446482a;width:min(300px,calc(100vw - 32px));max-height:min(60vh,420px);overflow:auto}
.pet-panel h3{margin:0 0 9px;font-size:14px;line-height:1.35}
.pet-panel ul{list-style:none;margin:0;padding:0;display:grid;gap:7px}
.pet-task{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border-radius:10px;background:#f3f7f7;font-size:13px;line-height:1.35}
.pet-task.attention{background:#fff3e6}
.pet-task.problem{background:#fdeaea;color:#8a2f2f}
.pet-task.ok{background:#e9f6f1;color:#0f5c59}
.pet-go{flex:0 0 auto;padding:5px 10px;border-radius:7px;background:var(--teal);color:#fff;font-size:12px;font-weight:600}
.pet-foot{margin:11px 0 0;font-size:12px;color:var(--muted);line-height:1.5}
/* character — owner 10-23: the doctor bunny (drawn poses, Agume's «Цагаахан» in a white coat) */
.pet-art{position:relative;display:block;width:120px;height:120px}
.pet-sprite{display:block;width:120px;height:120px;object-fit:contain;transform-origin:50% 94%;animation:pet-breathe 3.6s ease-in-out infinite;pointer-events:none;-webkit-user-drag:none}
.pet-shadow{position:absolute;left:50%;bottom:5px;width:60px;height:10px;margin-left:-30px;border-radius:50%;background:#6a3d3a26;filter:blur(2px)}
.pet[data-mood=sleepy] .pet-sprite{animation-duration:6.5s}
.pet[data-mood=alert] .pet-sprite{animation:pet-hop 1.8s ease-in-out infinite}
.pet.pet-away{opacity:0;pointer-events:none}
@keyframes pet-breathe{0%,100%{transform:scale(1,1)}50%{transform:scale(.988,1.018)}}
@keyframes pet-hop{0%,62%,100%{transform:translateY(0)}74%{transform:translateY(-9px)}86%{transform:translateY(0)}93%{transform:translateY(-3px)}}
@media(prefers-reduced-motion:reduce){.pet-sprite{animation:none}}
@media(max-width:680px){.pet{right:10px;bottom:10px;max-width:calc(100vw - 20px)}.pet-art,.pet-sprite{width:94px;height:94px}.pet-bubble{max-width:210px;font-size:12px}}
/* the first visit of the day: big hello in the middle, then back to the corner */
.pet-hello{position:fixed;inset:0;z-index:60;display:grid;place-items:center;padding:16px;background:#0f2a2a33;backdrop-filter:blur(2px);animation:pet-fade .35s ease both;cursor:pointer;transition:background .6s,backdrop-filter .6s}
.pet-hello-card{display:flex;flex-direction:column;align-items:center;gap:12px;animation:pet-pop .65s cubic-bezier(.2,1.35,.4,1) both}
.pet-hello-bubble{position:relative;max-width:min(430px,88vw);background:#fff;border-radius:20px;padding:16px 22px;font-size:18px;line-height:1.55;color:#1d2b28;text-align:center;white-space:pre-line;box-shadow:0 16px 44px #00000030}
.pet-hello-bubble::after{content:"";position:absolute;left:50%;bottom:-8px;width:18px;height:18px;margin-left:-9px;background:inherit;transform:rotate(45deg);border-radius:3px}
.pet-hello-sprite{width:min(280px,62vw);height:auto;transform-origin:50% 94%;animation:pet-breathe 3s ease-in-out infinite;-webkit-user-drag:none}
.pet-hello.leaving{background:transparent;backdrop-filter:none;pointer-events:none}
.pet-hello.leaving .pet-hello-card{animation:pet-go .75s cubic-bezier(.55,0,.3,1) both}
@keyframes pet-fade{from{opacity:0}}
@keyframes pet-pop{from{opacity:0;transform:translateY(60px) scale(.3)}to{opacity:1;transform:none}}
@keyframes pet-go{to{opacity:0;transform:translate(var(--dx,38vw),var(--dy,38vh)) scale(.32)}}
:root[data-theme=dark] .pet-hello-bubble{background:#17282a;color:#e7f0ef}
@media(prefers-reduced-motion:reduce){.pet-hello-card,.pet-hello-sprite,.pet-hello.leaving .pet-hello-card{animation:none}}
@media(max-width:680px){.pet-hello-bubble{font-size:16px;padding:14px 16px}}
@media print{.pet,.pet-chip{display:none!important}}
:root[data-theme=dark] .pet-bubble,:root[data-theme=dark] .pet-panel{background:#17282a;color:#e7f0ef;border-color:#2c4244}

.pet-panel h4{margin:13px 0 6px;font-size:11px;letter-spacing:.9px;text-transform:uppercase;color:var(--muted);font-weight:700}
.pet-feed{max-height:210px;overflow:auto}
.pet-act{display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:center;padding:7px 9px;border-radius:9px;background:#f6f9f9;font-size:12.5px;line-height:1.35}
.pet-act.attention{background:#fff3e6}
.pet-when{font-size:11px;color:var(--muted);min-width:34px}
.pet-day{display:grid;gap:5px;margin:0 0 9px;font-size:12.5px}
.pet-times{display:flex;flex-wrap:wrap;gap:4px}
.pet-times i{font-style:normal;padding:2px 7px;border-radius:999px;background:#e4f2ef;color:#0f5c59;font-size:12px}
.pet-none{color:var(--muted)}
.pet-chip.has-work::after{content:"";position:absolute;top:2px;right:2px;width:11px;height:11px;border-radius:50%;background:#ef7d57;border:2px solid #fff}
.pet.pet-ping .pet-body{animation:pet-ping 1.1s ease-in-out 3}
.pet.pet-ping .pet-bubble{border-color:#ef7d57;box-shadow:0 8px 28px #ef7d5738}
@keyframes pet-ping{0%,100%{transform:translateY(0)}30%{transform:translateY(-12px)}55%{transform:translateY(0)}75%{transform:translateY(-5px)}}
@media(prefers-reduced-motion:reduce){.pet.pet-ping .pet-body{animation:none}}

.pet-report{margin:0 0 4px;padding:9px 11px;border-radius:11px;background:#eef6ff;font-size:12.5px;line-height:1.4}
.pet-report p{margin:4px 0 0}.pet-report small{color:var(--muted)}
.pet-switches{display:grid;gap:6px}
.pet-switch{display:flex;align-items:center;gap:8px;font-size:12.5px;cursor:pointer}
.pet-switch.dim{opacity:.5}
.pet-switch input{width:auto;padding:0}

/* owner 10-20: the task box next to the pet */
.pet-ask{background:#fff;border:1px solid var(--line);border-radius:16px;padding:12px 12px 10px;box-shadow:0 14px 40px #2446482a;width:min(330px,calc(100vw - 32px));user-select:text;touch-action:auto;display:grid;gap:8px}
.pet-ask-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px}
.pet-ask-info,.pet-ask-clear,.pet-to-ask{padding:4px 9px;border-radius:8px;background:#eef6f5;color:#0f5c59;font-size:12px;font-weight:600;border:0}
.pet-to-ask{margin:0 0 10px}
.pet-ask-log{max-height:min(46vh,300px);overflow:auto;display:grid;gap:6px;align-content:start}
.pet-ask-hint{margin:0;font-size:12.5px;color:var(--muted);line-height:1.45}
.pet-msg{display:flex}.pet-msg span{padding:7px 11px;border-radius:13px;font-size:13px;line-height:1.4;max-width:88%;white-space:pre-wrap;word-break:break-word}
.pet-msg.me{justify-content:flex-end}.pet-msg.me span{background:#137c77;color:#fff;border-bottom-right-radius:4px}
.pet-msg.bot span{background:#f1f5f5;color:var(--ink);border-bottom-left-radius:4px}
.pet-msg.error span{background:#fdeaea;color:#8a2f2f}
.pet-msg.typing span{letter-spacing:2px;color:var(--muted)}
.pet-card{border:1px solid #cfe3df;border-radius:12px;padding:9px 10px;background:#f8fcfb;font-size:12.5px;line-height:1.4}
.pet-card p{margin:0 0 7px}.pet-card small{color:var(--muted)}
.pet-card.done{border-color:#bfe3cf;background:#effaf3}.pet-card.cancelled{opacity:.6}.pet-card.failed{border-color:#f1c5c5;background:#fdf3f3}
.pet-card-buttons{display:flex;gap:6px}
.pet-yes{padding:6px 14px;border-radius:8px;background:var(--teal);color:#fff;font-weight:700;font-size:12.5px;border:0}
.pet-no{padding:6px 12px;border-radius:8px;background:#fff;border:1px solid var(--line);color:var(--muted);font-size:12.5px}
.pet-ask-form{display:flex;gap:6px;align-items:flex-end}
.pet-ask-form textarea{flex:1;resize:none;min-height:40px;max-height:120px;padding:8px 10px;border-radius:10px;border:1px solid var(--line);font:inherit;font-size:13px;line-height:1.4}
.pet-ask-send{width:38px;height:38px;border-radius:10px;background:var(--teal);color:#fff;font-size:16px;border:0;padding:0}
.pet-ask-send:disabled,.pet-ask-form textarea:disabled{opacity:.55}
.pet-ask-foot{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:11px;color:var(--muted)}
:root[data-theme=dark] .pet-ask{background:#17282a;color:#e7f0ef;border-color:#2c4244}
:root[data-theme=dark] .pet-msg.bot span{background:#20383a;color:#e7f0ef}
:root[data-theme=dark] .pet-card{background:#1b3133;border-color:#2c4244}
:root[data-theme=dark] .pet-ask-form textarea{background:#10201f;color:#e7f0ef;border-color:#2c4244}
@media(max-width:680px){.pet-ask{width:calc(100vw - 24px)}}
