/* Alani's 3D character (public/js/avatar/avatar.js): a transparent window as big as she needs (her arms go out and up without being cut), moved over the whole app by script.
   It sits above the page and below dialogs; the voice bar, the message bar and the navigation are cut out of it (clip-path), so she is behind them. Touches go through it: touch.js
   answers only the ones that land on her. */
.avatar-stage { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; will-change: transform; contain: layout style; }
.avatar-canvas { display: block; width: 100%; height: 100%; }
/* the edit mode (hold the voice bar's person button): an orange frame around her. It is above the bars (she is mostly behind them), lets every touch through (touch.js answers the ones
   that land inside it) except on its own corners and buttons. */
.avatar-frame { position: fixed; left: 0; top: 0; z-index: 40; display: none; pointer-events: none; box-sizing: border-box; border: 2px solid var(--orange); border-radius: 10px; background: color-mix(in srgb, var(--orange) 7%, transparent); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 18px color-mix(in srgb, var(--orange) 45%, transparent); will-change: transform; }
.avatar-frame.on { display: block; }
.avatar-corner { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; box-sizing: border-box; border: 2px solid #fff; border-radius: 6px; background: var(--orange); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); pointer-events: auto; touch-action: none; }
.avatar-corner::after { content: ""; position: absolute; inset: -12px; } /* (a finger-sized place to grab) */
.avatar-corner[data-corner="nw"], .avatar-corner[data-corner="se"] { cursor: nwse-resize; }
.avatar-corner[data-corner="ne"], .avatar-corner[data-corner="sw"] { cursor: nesw-resize; }
.avatar-bar { position: absolute; display: flex; gap: 6px; transform: translateX(-50%); pointer-events: auto; touch-action: manipulation; }
.avatar-bar .btn { box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45); }
.ai-voicebar .vo-avatar { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ai-voicebar .vo-avatar.off { opacity: 0.45; }
.ai-voicebar .vo-avatar.editing { color: var(--orange); }
html.av-grab, html.av-grab * { cursor: grab !important; }

/* the performance panel (developers): public/js/avatar/perfHud.js */
.av-hud { position: fixed; z-index: 90; right: 8px; top: 8px; width: min(420px, calc(calc(100vw / var(--ui-scale, 1)) - 16px)); max-height: calc(calc(100dvh / var(--ui-scale, 1)) - 16px); overflow: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); font-size: 0.78rem; line-height: 1.35; }
.av-hud h4 { margin: 8px 0 4px; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--orange); }
.av-hud .av-head { display: flex; align-items: center; gap: 8px; }
.av-hud .av-head b { flex: 1; font-size: 0.9rem; }
.av-hud table { width: 100%; border-collapse: collapse; }
.av-hud td { padding: 1px 0; vertical-align: top; }
.av-hud td:first-child { color: var(--muted); padding-right: 8px; white-space: nowrap; }
.av-hud td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.av-hud .av-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.av-hud .av-row .btn { padding: 4px 10px; font-size: 0.76rem; }
.av-hud .av-bad { color: #ff8a80; }
.av-hud .av-ok { color: var(--done); }
.av-hud pre { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; color: var(--muted); font-size: 0.72rem; }
.av-spark { display: block; width: 100%; height: 34px; margin-top: 2px; }
@media (max-width: 700px) { .av-hud { top: auto; bottom: 8px; right: 8px; max-height: calc(60dvh / var(--ui-scale, 1)); } }

/* the chibi Alani as a picture in the app's pages (js/chibiFace.js: one sticker, or a few she cycles through, popping a little each time) */
.chibi-face { display: block; width: auto; max-width: 100%; object-fit: contain; -webkit-user-select: none; user-select: none; }
.chibi-face.pop { animation: chibi-pop 0.32s ease-out; }
@keyframes chibi-pop { 0% { transform: scale(0.9) rotate(-2deg); } 55% { transform: scale(1.06) rotate(1deg); } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .chibi-face.pop { animation: none; } }

/* the character choice in the Alani AI settings: voice only, the chibi or the 3D model */
.av-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.av-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--input); color: inherit; text-align: center; cursor: pointer; font: inherit; }
.av-choice .av-pic { display: grid; place-items: center; height: 88px; }
.av-choice .av-pic .av-logo { border-radius: 22px; object-fit: cover; }
.av-choice b { font-size: 0.95rem; }
.av-choice.on { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 10%, var(--input)); }
