/* Ada assistant */
.ada { position: fixed; right: 22px; bottom: 14px; z-index: 600; width: 116px; pointer-events: none; }
.ada-btn { pointer-events: auto; display: block; width: 116px; height: 150px; border: 0; background: none; padding: 0; cursor: grab; touch-action: none; animation: adaIn .7s cubic-bezier(.3, 1.6, .5, 1); }
.ada-btn:active { cursor: grabbing; }
.ada-char { width: 100%; height: 100%; overflow: visible; }
.ada-body { animation: adaBob 3s ease-in-out infinite; transform-origin: 90px 222px; transform-box: view-box; }
.ada-btn:hover .ada-body { animation-duration: 1.2s; }
.ada-shadow { animation: adaShadow 3s ease-in-out infinite; transform-origin: 90px 224px; transform-box: view-box; }
.ada-eyes { animation: adaBlink 5s infinite; transform-origin: 90px 62px; transform-box: view-box; }
.ada-eyes-closed, .ada-m-open, .ada-m-o, .ada-think, .ada-zzz, .ada-spark { display: none; }
.ada-arm-r { transform-origin: 116px 104px; transform-box: view-box; transition: transform .3s; }
.ada-head { transform-origin: 90px 86px; transform-box: view-box; }
.talking .ada-m-smile { animation: adaTalkA .32s steps(1) infinite; }
.talking .ada-m-open { display: block; animation: adaTalkB .32s steps(1) infinite; }
.talking .ada-head { animation: adaNod 1.2s ease-in-out infinite; }
.waving .ada-arm-r { animation: adaWave .45s ease-in-out infinite alternate; }
.waving .ada-spark { display: block; animation: adaSpark .9s ease-in-out infinite alternate; }
.thinking .ada-think { display: block; } .thinking .ada-m-smile { display: none; } .thinking .ada-m-o { display: block; }
.thinking .ada-head { transform: rotate(-6deg); }
.ada-spin { animation: adaSpin 2.4s linear infinite; } .ada-spin2 { animation: adaSpin 1.6s linear infinite reverse; }
.ada-spin, .ada-spin2 { transform-box: fill-box; transform-origin: center; }
.sleeping .ada-eyes, .sleeping .ada-brow { display: none; } .sleeping .ada-eyes-closed { display: block; } .sleeping .ada-zzz { display: block; animation: adaZ 2.2s ease-in-out infinite; }
.sleeping .ada-head { transform: rotate(8deg); } .sleeping .ada-body { animation-duration: 5s; }
.happy .ada-spark { display: block; animation: adaSpark .6s ease-in-out infinite alternate; }
.happy .ada-body { animation: adaHop .5s ease-in-out 3; }
/* machinery: the engine idles slowly, whirs when Ada talks or thinks */
.ada-gearA, .ada-crank, .ada-cards { transform-box: fill-box; transform-origin: center; }
.ada-gearA { animation: adaSpin 9s linear infinite; }
.ada-crank { animation: adaSpin 6s linear infinite reverse; }
.ada-cards { transform-origin: top center; animation: adaSway 3.4s ease-in-out infinite; }
.ada-led { animation: adaLed 2.2s ease-in-out infinite; } .ada-led-glow { animation: adaLed 2.2s ease-in-out infinite; }
.ada-vial { animation: adaLed 3.2s ease-in-out infinite; }
.talking .ada-gearA, .thinking .ada-gearA { animation-duration: 1.4s; }
.talking .ada-crank, .thinking .ada-crank { animation-duration: 1s; }
.talking .ada-led, .talking .ada-led-glow, .thinking .ada-led, .thinking .ada-led-glow { animation-duration: .35s; }
.talking .ada-digit, .thinking .ada-digit { animation: adaTick .45s steps(2) infinite; }
.sleeping .ada-gearA, .sleeping .ada-crank, .sleeping .ada-led, .sleeping .ada-led-glow { animation-play-state: paused; }
.sleeping .ada-led { opacity: .3; }
.ada-glint { animation: adaGlint 6s ease-in-out infinite; }
@keyframes adaSway { 50% { transform: rotate(3deg); } }
@keyframes adaLed { 50% { opacity: .35; } }
@keyframes adaTick { 50% { transform: translateY(1.3px); } }
@keyframes adaGlint { 0%, 85%, 100% { opacity: .85; } 92% { opacity: .2; } }
@keyframes adaIn { from { transform: translateY(160px) scale(.5); opacity: 0; } }
@keyframes adaBob { 50% { transform: translateY(-3.5px); } }
@keyframes adaShadow { 50% { transform: scaleX(.9); opacity: .14; } }
@keyframes adaBlink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@keyframes adaTalkA { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes adaTalkB { 0% { opacity: 0; } 50% { opacity: 1; } }
@keyframes adaNod { 50% { transform: rotate(2deg) translateY(1px); } }
@keyframes adaWave { from { transform: rotate(-125deg); } to { transform: rotate(-160deg); } }
@keyframes adaSpin { to { transform: rotate(360deg); } }
@keyframes adaZ { 0% { opacity: 0; transform: translate(-6px, 8px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(4px, -6px); } }
@keyframes adaSpark { to { opacity: .2; } }
@keyframes adaHop { 50% { transform: translateY(-12px); } }

.ada-bubble { pointer-events: auto; position: absolute; right: 70px; bottom: 132px; width: max-content; max-width: min(320px, calc(100vw - 40px)); background: #ffffe1; color: #1d1d1b; border: 2px solid #1d1d1b; border-radius: 12px; padding: 12px 14px 10px; box-shadow: 4px 4px 0 #1d1d1b; font: 13px/1.5 var(--sans); opacity: 0; transform: translateY(8px) scale(.96); transition: .18s; visibility: hidden; }
.ada-bubble.on { opacity: 1; transform: none; visibility: visible; }
.ada-bubble::after { content: ''; position: absolute; right: 18px; bottom: -12px; width: 18px; height: 18px; background: #ffffe1; border-right: 2px solid #1d1d1b; border-bottom: 2px solid #1d1d1b; transform: skewX(30deg) rotate(45deg); }
.ada-bubble p { margin: 0 14px 4px 0; }
.ada-x { position: absolute; top: 2px; right: 6px; border: 0; background: none; font-size: 18px; cursor: pointer; color: #1d1d1b; line-height: 1; }
.ada-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } .ada-acts.col { flex-direction: column; }
.ada-acts button, .ada-link { border: 2px solid #1d1d1b; background: #fff; border-radius: 7px; padding: 5px 9px; font: 600 12px var(--mono); cursor: pointer; text-align: left; color: #1d1d1b; }
.ada-acts button:hover, .ada-link:hover { background: #2f9c9a; color: #fff; }
.ada-link { padding: 2px 7px; font-size: 11px; margin: 2px 0; display: inline-block; }
.ada-chat { position: fixed; right: 140px; bottom: 20px; width: min(360px, calc(100vw - 24px)); height: min(480px, calc(100vh - 100px)); z-index: 610; }
.ada-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ada-msg { background: #ffffe1; color: #1d1d1b; border: 2px solid #1d1d1b; border-radius: 10px 10px 10px 2px; padding: 8px 10px; font-size: 13px; max-width: 88%; align-self: flex-start; }
.ada-msg.me { background: var(--accent); color: #fff; border-radius: 10px 10px 2px 10px; align-self: flex-end; }
.ada-sugg { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 10px 6px; }
.ada-sugg button { border: 1.5px solid var(--ink); background: var(--paper); border-radius: 12px; font: 10.5px var(--mono); padding: 2px 8px; cursor: pointer; color: var(--ink); }
.ada-in { display: flex; gap: 6px; padding: 10px; border-top: var(--b); }
body.presenting .ada, body.presenting .ada-chat { display: none; }
body.body-desk .ada:not([style*=bottom]) { bottom: 76px; }
@media (max-width: 860px) { .ada { width: 82px; right: 8px; } .ada-btn { width: 82px; height: 106px; } .ada-bubble { right: 40px; bottom: 96px; } .ada-chat { right: 12px; bottom: 120px; } }
