/* 비서(핍): 차트 위 캐릭터 · 말풍선 카드 · 사이드바 패널 (js/agent/pet.js · panel.js) */
#pet { position: absolute; left: 0; top: 0; width: 110px; height: 91px; z-index: 6; cursor: pointer; will-change: transform; outline: none; }
#pet.moving { transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
#pet:focus-visible .pet-body { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 10px; }
.pet-body { width: 100%; height: 100%; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .45)); transform-origin: 50% 50%; }
.pet-body.hop { animation: pet-hop .35s ease-out; }
@keyframes pet-hop { 30% { translate: 0 -10px; } 100% { translate: 0 0; } }
.pet-img, .pet-cv { width: 100%; height: 100%; display: block; }
#pet[data-state="5"] .pet-body { opacity: .6; }
.pet-say { position: absolute; left: 0; top: 0; max-width: 240px; background: #fff; color: #171a25; border-radius: 10px; padding: 5px 10px; font: 600 12.5px/1.4 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); pointer-events: none; z-index: 1; }
.pet-say::after { content: ""; position: absolute; left: 16px; bottom: -5px; width: 10px; height: 10px; background: #fff; transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { #pet.moving { transition: none; } .pet-body.hop { animation: none; } }

/* 말풍선 카드 */
#agentCard { position: absolute; left: 0; top: 0; width: min(390px, calc(100% - 90px)); max-height: calc(100% - 60px); z-index: 7; display: flex; flex-direction: column; background: color-mix(in srgb, var(--win) 94%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .45); will-change: transform; }
#agentCard[hidden] { display: none; }
.ag-msgs { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 12px 12px 6px; display: grid; gap: 10px; align-content: start; font-size: 13px; }
#agentCard .ag-msgs { max-height: 320px; }
.ag-me { justify-self: end; max-width: 88%; background: var(--win-2); border: 1px solid var(--line-2); border-radius: 12px 12px 3px 12px; padding: 7px 11px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.ag-pip { display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; align-items: start; color: var(--text); }
.ag-pip .ag-face { width: 22px; height: 22px; margin-top: 2px; grid-row: 1 / span 9; }
.ag-pip p { margin: 0; word-break: break-word; }
.ag-pip p + p { margin-top: 4px; color: var(--text-2); }
.ag-pip.ag-wait p { color: var(--text-3); animation: ag-blink 1.2s ease-in-out infinite; }
@keyframes ag-blink { 50% { opacity: .45; } }
.ag-did { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.ag-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 9px; font-size: 12px; color: var(--text-2); background: var(--win); font-variant-numeric: tabular-nums; }
.ag-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-2); display: inline-block; }
.ag-link { font: 12px var(--font); color: var(--brand-2); background: none; border: 0; padding: 2px 4px; cursor: pointer; border-radius: 4px; }
.ag-link:hover { background: var(--hover); }
.ag-undone { font-size: 12px; color: var(--text-3); }
.ag-in { display: flex; align-items: flex-end; gap: 8px; margin: 6px 10px 0; background: var(--win-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 6px 6px 10px; min-height: 40px; }
.ag-in:focus-within { border-color: var(--text-3); }
.ag-in textarea { flex: 1 1 0; width: 100%; min-width: 0 !important; max-width: none !important; background: none !important; border: 0 !important; outline: 0; box-shadow: none !important; border-radius: 0; color: var(--text); font: 13px/1.45 var(--font); resize: none; max-height: 140px; overflow-y: auto; padding: 4px 0 !important; margin: 0; height: auto; }
.ag-send { flex: none; margin-bottom: 1px; position: relative; z-index: 1; }
.ag-in textarea:focus, .ag-in textarea:focus-visible { outline: none !important; box-shadow: none !important; border: 0 !important; } /* 앱 공통 포커스 테두리(보라)는 바깥 상자가 대신한다 */
.ag-in textarea::placeholder { color: var(--text-3); }
.ag-send { width: 26px; height: 26px; border: 0; border-radius: 7px; background: var(--brand); cursor: pointer; position: relative; }
.ag-send::before { content: ""; position: absolute; left: 7px; top: 8px; width: 9px; height: 9px; border-right: 2px solid #fff; border-top: 2px solid #fff; transform: rotate(45deg); }
.ag-send:disabled { opacity: .4; }
.ag-foot { display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px; flex-wrap: wrap; }
.ag-tierrow { padding-top: 0; gap: 8px; }
.ag-foot .sp { flex: 1; }
.ag-empty { color: var(--text-2); display: grid; gap: 6px; justify-items: start; }
.ag-empty p { margin: 0 0 4px; }
.ag-sug { font: 12px var(--font); color: var(--text-2); background: none; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.ag-sug:hover { border-color: var(--brand); color: var(--text); }
.ag-dim { color: var(--text-3); }

/* 사이드바 패널 */
.panel[data-p="agent"] { overflow: hidden; }
.panel[data-p="agent"] .p-head .ag-face { width: 22px; height: 22px; }
.panel[data-p="agent"] .ag-in { margin: 8px 10px 10px; }
#rail .ag-face { width: 20px; height: 20px; }

@media (max-width: 640px) {
  #agentCard { width: calc(100% - 16px); }
  #pet { width: 84px; height: 70px; }
}
