.coach-fab {
  position: fixed; right: 16px; bottom: calc(16px + var(--safe-bottom)); z-index: 900;
  display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 28px;
  font: 600 16px Roboto, Arial, sans-serif; color: white; cursor: pointer;
  background: linear-gradient(135deg, #4285F4, #9B72CB 55%, #D96570);
  box-shadow: 0 10px 28px rgba(110, 80, 180, .38); transition: transform .2s var(--ease), opacity .2s;
}
.coach-fab:hover, .coach-fab:focus-visible { transform: translateY(-2px) scale(1.02); }
.coach-fab:focus-visible { outline: 3px solid #1A73E8; outline-offset: 3px; }
.coach-fab i { animation: twinkle-ai 3s ease-in-out infinite; }
@keyframes twinkle-ai { 50% { transform: rotate(18deg) scale(1.15); } }
body.map-mode .coach-fab, body.coach-open .coach-fab, body.locked .coach-fab { opacity: 0; pointer-events: none; transform: scale(.8); }
main { padding-bottom: calc(96px + var(--safe-bottom)); }

.coach-scrim { position: fixed; inset: 0; z-index: 1350; background: rgba(30, 20, 50, .35); backdrop-filter: blur(3px); }
.coach {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1400; height: min(88vh, 760px);
  display: flex; flex-direction: column; background: #FBFAFE; color: #1F1B24;
  border-radius: 28px 28px 0 0; box-shadow: 0 -16px 48px rgba(40, 20, 80, .25);
  animation: coach-up .38s cubic-bezier(.2, .8, .2, 1); font-size: 17px; line-height: 26px;
}
@keyframes coach-up { from { transform: translateY(100%); } }
@media (min-width: 720px) { .coach { left: auto; right: 20px; bottom: 20px; width: 440px; border-radius: 28px; } }
.coach-head { display: flex; align-items: center; gap: 12px; padding: 14px 10px 10px 18px; border-bottom: 1px solid #ECE6F5; }
.coach-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: white; background: linear-gradient(135deg, #4285F4, #9B72CB, #D96570); }
.coach-titles { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.coach-titles h2 { font-size: 19px; font-weight: 600; }
.coach-titles span { font-size: 14px; color: #5E5670; }
.coach-head .icon-btn[aria-pressed="true"] { color: #6B4FBB; background: #EFE9FB; }

.coach-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.coach-log > * { flex-shrink: 0; }
.bubble { position: relative; max-width: 88%; padding: 12px 16px; border-radius: 20px; animation: bubble-in .3s cubic-bezier(.2, .8, .2, 1); overflow-wrap: anywhere; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.bubble.user { align-self: flex-end; background: #6B4FBB; color: white; border-bottom-right-radius: 6px; }
.bubble.ai { align-self: flex-start; background: white; border: 1px solid #ECE6F5; border-bottom-left-radius: 6px; padding-right: 40px; }
.bubble .markdown { font-size: 17px; }
.bubble .markdown p { margin: 4px 0; }
.bubble-speak { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #6B5E85; cursor: pointer; display: grid; place-items: center; }
.bubble-speak:hover, .bubble-speak:focus-visible { background: #F1ECFA; }
.bubble-speak i { font-size: 20px; }
.typing { display: flex; gap: 5px; padding: 6px 2px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: #9B72CB; animation: typing 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }

.coach-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px 4px; scrollbar-width: none; }
.coach-chips::-webkit-scrollbar { display: none; }
.coach-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #DDD3EE; background: white; color: #3E3550; font: 500 15px Roboto, Arial, sans-serif; cursor: pointer; }
.coach-chip i { font-size: 18px; color: #6B4FBB; }
.coach-chip:hover, .coach-chip:focus-visible { background: #F4EFFC; border-color: #B9A6E2; }
.coach-input { display: flex; align-items: center; gap: 6px; padding: 10px 12px calc(12px + var(--safe-bottom)); }
.coach-input input { flex: 1; min-width: 0; height: 52px; border-radius: 26px; border: 1.5px solid #DDD3EE; background: white; padding: 0 18px; font: 17px Roboto, Arial, sans-serif; color: #1F1B24; outline: none; }
.coach-input input:focus { border-color: #6B4FBB; box-shadow: 0 0 0 3px rgba(107, 79, 187, .18); }
.coach-send { width: 52px; height: 52px; flex: none; border: 0; border-radius: 50%; background: #6B4FBB; color: white; cursor: pointer; display: grid; place-items: center; }
.coach-send:focus-visible, .coach .icon-btn:focus-visible { outline: 3px solid #1A73E8; outline-offset: 2px; }
#coach-mic.listening { color: white; background: #D96570; animation: pulse-mic 1.2s infinite; }
@keyframes pulse-mic { 50% { box-shadow: 0 0 0 10px rgba(217, 101, 112, .2); } }

.coach-card { align-self: stretch; background: white; border: 1px solid #ECE6F5; border-radius: 22px; overflow: hidden; animation: bubble-in .4s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 6px 20px rgba(80, 50, 140, .08); }
.cc-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.cc-head i { color: #6B4FBB; }
.cc-body { padding: 14px 16px 16px; }
.cc-body h3 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.cc-body p { margin: 4px 0 8px; }
.cc-visual { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, #E8F0FE, #F3E8FD 50%, #FCE8EC); overflow: hidden; }
.cc-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #5E5670; text-align: center; padding: 16px; }
.cc-placeholder > i { font-size: 36px; color: #9B72CB; }
.cc-drawing { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #5E5670; }
.cc-drawing .skel { position: absolute; inset: 0; border-radius: 0; background: linear-gradient(100deg, #EDE7F9 20%, #FFFFFF 40%, #F3E8FD 60%, #EDE7F9 80%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.cc-drawing p { position: relative; font-weight: 500; }
.cc-img { width: 100%; height: 100%; object-fit: cover; display: block; animation: photoreveal 1s cubic-bezier(.2, .8, .2, 1) both; }
.cc-badge { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 14px; font-size: 13px; color: white; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); }
.cc-badge i { font-size: 16px; }
.cc-uses { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cc-uses span { font-size: 14px; padding: 4px 10px; border-radius: 14px; background: #EEF6EE; color: #22543D; }
.cc-steps { padding-left: 22px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.cc-steps li::marker { color: #6B4FBB; font-weight: 600; }
.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding: 0 16px 14px; }
.cc-body .cc-actions { padding: 0; }
.cc-actions .btn { border-radius: 22px; }
.cc-stops { margin: 6px 0 4px; padding: 0 16px 0 38px; display: flex; flex-direction: column; gap: 6px; }
.cc-stops span { color: #5E5670; font-size: 14px; margin-left: 4px; }
.coach-card > p { padding: 0 16px 14px; margin: 0; }
.cc-report { margin: 6px 16px 4px; padding: 12px; border-radius: 14px; background: #F7F5FB; font: 15px/22px Roboto, Arial, sans-serif; white-space: pre-wrap; max-height: 220px; overflow: auto; }

.project summary { display: flex; align-items: center; gap: 12px; }
.proj-thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; flex: none; }
.empty-thumb { display: grid; place-items: center; background: #F1ECFA; color: #6B4FBB; }
.proj-title { flex: 1; }
.proj-image { width: 100%; border-radius: 16px; margin: 10px 0 4px; animation: photoreveal .9s cubic-bezier(.2, .8, .2, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .coach, .bubble, .coach-card, .cc-img, .proj-image, .coach-fab i { animation: none !important; }
}

/* Project card notes: safety and what it saves */
.cc-note { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: #FFF6E0; color: #5A4300; font-size: 13.5px; }
.cc-note i { font-size: 18px; flex: none; }
.cc-note.good { background: #E6F4EA; color: #1E5631; }
