/* BukiGPT chat */
#bgpt { position: fixed; right: 1.5rem; bottom: 6.7rem; z-index: 520; font-family: var(--font-body); }
.bgpt-fab {
  position: relative; display: block; width: 74px; height: 74px; padding: 0; cursor: pointer; border-radius: 50%;
  background: #fff; border: 4px solid var(--blue); box-shadow: 0 6px 0 var(--blue), 0 14px 26px rgba(0, 0, 0, .22);
  transition: transform .3s var(--bounce);
}
.bgpt-fab:hover { transform: translateY(-4px) rotate(-6deg) scale(1.06); }
.bgpt-fab img { width: 100%; height: 100%; object-fit: contain; padding: 6px; border-radius: 50%; animation: bukiBob 3.4s ease-in-out infinite; }
.bgpt-fab::after { content: ''; position: absolute; right: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #25d366; border: 3px solid #fff; }
#bgpt.seen .bgpt-fab::after { display: none; }
.bgpt-nudge {
  position: absolute; right: 84px; top: 50%; transform: translateY(-50%) scale(.85); transform-origin: right center; opacity: 0; pointer-events: none; white-space: nowrap;
  padding: .55rem 1rem; border-radius: 20px 20px 4px 20px; background: #fff; color: var(--text); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--chunk);
  font-family: var(--font-display); font-weight: 600; font-size: 1rem; transition: opacity .3s, transform .4s var(--bounce);
}
#bgpt.nudge .bgpt-nudge { opacity: 1; transform: translateY(-50%) scale(1); }
#bgpt.open .bgpt-nudge { display: none; }
#bgpt.open .bgpt-fab { visibility: hidden; }

.bgpt-panel {
  position: fixed; right: 1.5rem; bottom: 1.5rem; width: min(400px, calc(100vw - 2rem)); height: min(640px, calc(100vh - 3rem)); display: flex; flex-direction: column;
  background: var(--bg); border: 4px solid var(--blue); border-radius: 30px; overflow: hidden; box-shadow: 0 8px 0 var(--blue), 0 24px 50px rgba(0, 0, 0, .28);
  transform-origin: bottom right; opacity: 0; transform: translateY(16px) scale(.9); transition: opacity .25s, transform .35s var(--bounce);
}
#bgpt.open .bgpt-panel { opacity: 1; transform: none; }
.bgpt-panel[hidden] { display: none; }

.bgpt-head { display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; background: var(--blue); color: #fff; }
.bgpt-av { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%; background: #fff; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; border: 3px solid rgba(255, 255, 255, .6); }
.bgpt-av img { width: 100%; height: auto; }
.bgpt-head b { display: block; font-family: var(--font-display); font-size: 1.25rem; line-height: 1.05; }
.bgpt-head small { display: flex; align-items: center; gap: .35rem; font-size: .78rem; opacity: .92; }
.bgpt-head small i { width: 9px; height: 9px; border-radius: 50%; background: #5dff9a; box-shadow: 0 0 0 3px rgba(93, 255, 154, .3); }
.bgpt-x { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .15); color: #fff; cursor: pointer; font-size: 1rem; }
.bgpt-x:hover { background: rgba(255, 255, 255, .3); }

.bgpt-log { flex: 1; overflow-y: auto; padding: 1rem .9rem .4rem; display: flex; flex-direction: column; gap: .6rem; scroll-behavior: smooth; background-image: var(--scales); }
.bgpt-msg { max-width: 86%; padding: .65rem .95rem; border-radius: 6px 20px 20px 20px; font-size: .95rem; line-height: 1.45; animation: msgIn .35s var(--bounce) both; overflow-wrap: anywhere; }
.bgpt-msg.bot { background: #fff; color: #1b2a2f; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--chunk); align-self: flex-start; }
.bgpt-msg.me { align-self: flex-end; background: var(--blue); color: #fff; border-radius: 20px 6px 20px 20px; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.bgpt-msg b { font-weight: 800; color: var(--ink); }
.bgpt-msg.me b { color: #fff; }
.bgpt-msg.typing { display: flex; gap: 5px; padding: .85rem 1rem; }
.bgpt-msg.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); animation: bgptDot 1s ease-in-out infinite; }
.bgpt-msg.typing i:nth-child(2) { animation-delay: .15s; } .bgpt-msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bgptDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }

.bgpt-btns { display: flex; flex-wrap: wrap; gap: .45rem; align-self: flex-start; max-width: 92%; }
.bgpt-btn {
  padding: .45rem .9rem; border-radius: 999px; background: #ffd84d; color: #12224a; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: .9rem;
  border: 2px solid rgba(0, 0, 0, .25); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); transition: transform .2s var(--bounce);
}
.bgpt-btn:hover { transform: translateY(-2px) rotate(-2deg); }

.bgpt-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem .9rem .3rem; min-height: 8px; }
.bgpt-chip {
  padding: .4rem .85rem; border-radius: 999px; background: var(--surface); color: var(--text); border: 2px solid var(--line); cursor: pointer;
  font-family: var(--font-display); font-weight: 500; font-size: .88rem; box-shadow: 0 3px 0 var(--chunk); transition: transform .2s var(--bounce), background .2s;
}
.bgpt-chip:hover { background: var(--blue-lt); transform: translateY(-2px); }

.bgpt-form { display: flex; gap: .5rem; padding: .5rem .9rem .5rem; }
.bgpt-form input {
  flex: 1; min-width: 0; padding: .7rem 1rem; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: #1b2a2f; font: inherit; font-size: 1rem; outline: none;
}
.bgpt-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .2); }
.bgpt-form button { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .25); background: var(--blue); color: #fff; font-size: 1.15rem; cursor: pointer; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.bgpt-form button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.bgpt-note { margin: 0; padding: 0 1rem .7rem; text-align: center; font-size: .72rem; color: var(--text-muted); }

@media (max-width: 640px) {
  #bgpt { right: 1rem; bottom: 5.9rem; }
  .bgpt-fab { width: 62px; height: 62px; border-width: 3px; }
  .bgpt-nudge { display: none; }
  .bgpt-panel { right: .6rem; left: .6rem; bottom: .6rem; width: auto; height: min(84vh, 660px); border-radius: 26px; }
  .bgpt-form input { font-size: 16px; }
}
@media print { #bgpt { display: none; } }
@media (prefers-reduced-motion: reduce) { .bgpt-fab img, .bgpt-msg { animation: none; } }
