/* Chengjin Bot's mascot, motion and light dialog, adapted to the project guide. */
.guide-bot {
  position: fixed;
  left: 24px;
  top: 33vh;
  bottom: auto;
  z-index: 90;
  width: 52px;
  height: 52px;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, .25));
  transition: opacity 180ms ease, visibility 180ms ease;
  --hat-scale: 1.6;
  --hat-x: -62%;
  --hat-y: -90%;
  --hat-rot: -10deg;
  --hat-width: 110%;
  --hat-height: 74%;
}
.guide-bot__launcher[hidden], .guide-bot__panel[hidden], .guide-bot__backdrop[hidden] { display: none; }
.guide-bot__launcher, .guide-bot__panel { pointer-events: auto; }
.guide-bot__launcher {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid #f5f7fb;
  border-radius: 999px;
  background: #0b0b0f;
  color: #0f172a;
  box-shadow: 0 10px 18px rgba(15, 23, 42, .18), 0 0 12px rgba(0, 0, 0, .16);
  cursor: pointer;
  overflow: visible;
  touch-action: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.guide-bot__launcher:hover { transform: translateY(-2px) scale(1.04); }
.guide-bot.is-dragging .guide-bot__launcher { cursor: grabbing; }
.guide-bot__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}
.guide-bot__face::before {
  content: "";
  --eye-pair-center-x: -7px;
  position: relative;
  display: block;
  width: 6px;
  height: 16px;
  border-radius: 999px;
  background: #f7f8fb;
  box-shadow: 14px 0 0 #f7f8fb;
  transform: translate(calc(var(--eye-x, 0px) + var(--eye-pair-center-x)), var(--eye-y, 0px));
  transition: transform .08s ease-out;
}
.guide-bot__hat { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.guide-bot.is-festive .guide-bot__hat {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 3;
  display: block;
  width: var(--hat-width);
  height: var(--hat-height);
  overflow: visible;
  background: url("../img/guide-bot-hat.svg") no-repeat 50% 0 / contain;
  pointer-events: none;
  transform: translate(calc(var(--hat-x) + 4.5px), calc(var(--hat-y) + 14.5px)) rotate(var(--hat-rot)) scale(var(--hat-scale));
  transform-origin: 78% 90%;
}
.guide-bot__backdrop { display: none; }
.guide-bot__panel {
  position: absolute;
  left: calc(100% + 16px);
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  width: min(370px, calc(100vw - 96px));
  max-height: 78vh;
  overflow: hidden;
  border: 1px solid #c9d0cd;
  border-radius: 18px;
  background: #f8faf9;
  color: #0a0c0d;
  color-scheme: light;
  box-shadow: 0 28px 80px rgba(10, 12, 13, .26);
  font-family: "Avenir Next", Avenir, "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  transform-origin: left top;
}
.guide-bot__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #d3d9d6;
  background: #fff;
  cursor: grab;
}
.guide-bot.is-dragging .guide-bot__header { cursor: grabbing; }
.guide-bot__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #006b59;
  font: 700 12px/1.2 "SFMono-Regular", Menlo, "Cascadia Code", Consolas, monospace;
  letter-spacing: .025em;
}
.guide-bot__eyebrow span {
  width: 6px; height: 6px; border-radius: 50%; background: #55e6c1;
  box-shadow: 0 0 0 4px rgba(85, 230, 193, .16);
}
.guide-bot__header h2 {
  margin: 7px 0 0;
  color: #0a0c0d;
  font-family: inherit;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: normal;
}
.guide-bot__description { margin: 4px 0 0; color: #626a6d; font-size: 12px; line-height: 1.4; }
.guide-bot__controls { display: flex; align-items: flex-start; gap: 7px; }
.guide-bot__controls button {
  height: 32px;
  border: 1px solid #d3d9d6;
  background: transparent;
  color: #0a0c0d;
  cursor: pointer;
}
.guide-bot__controls button:hover { border-color: #0a0c0d; }
.guide-bot__language { padding: 0 8px; border-radius: 7px; font-size: 12px; }
.guide-bot__close { width: 32px; padding: 0; border-radius: 50%; font-size: 18px; line-height: 1; }
.guide-bot__messages {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  max-height: 310px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 15px;
  background-color: #edf1ef;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0H24M0 0V24' fill='none' stroke='%230a0c0d' stroke-opacity='.035'/%3E%3C/svg%3E");
}
.guide-bot__message {
  min-width: 0;
  max-width: 92%;
  padding: 10px 12px;
  border: 1px solid #d3d9d6;
  border-radius: 13px 13px 13px 3px;
  background: #fff;
  color: #343a3c;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.guide-bot__message p { margin: 0; }
.guide-bot__message--user {
  justify-self: end;
  border-color: #0a0c0d;
  border-radius: 13px 13px 3px 13px;
  background: #0a0c0d;
  color: #fff;
}
.guide-bot__message a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-top: 10px;
  padding: 0 10px;
  border-radius: 999px;
  background: #0a0c0d;
  color: #fff;
  font: 700 13px/1.3 "SFMono-Regular", Menlo, "Cascadia Code", Consolas, monospace;
  text-decoration: none;
}
.guide-bot__message a:hover { background: #006b59; }
.guide-bot__starters {
  display: flex;
  flex-wrap: wrap;
  min-height: 0;
  max-height: 128px;
  overflow: auto;
  overscroll-behavior: contain;
  gap: 6px;
  padding: 12px 15px;
  border-top: 1px solid #d3d9d6;
  background: #fff;
}
.guide-bot__starters button {
  padding: 6px 9px;
  border: 1px solid #d3d9d6;
  border-radius: 999px;
  background: #f1f4f2;
  color: #202426;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
}
.guide-bot__starters button:hover { border-color: #006b59; color: #006b59; }
.guide-bot__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px 15px 15px;
  border-top: 1px solid #d3d9d6;
  background: #fff;
}
.guide-bot__form input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 10px 11px;
  border: 1px solid #d3d9d6;
  border-radius: 9px;
  background: #f4f6f5;
  color: #0a0c0d;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.2;
}
.guide-bot__form input:focus { border-color: #006b59; background: #fff; box-shadow: 0 0 0 3px rgba(85, 230, 193, .15); }
.guide-bot__form button {
  padding: 0 13px;
  border: 1px solid #0a0c0d;
  border-radius: 9px;
  background: #0a0c0d;
  color: #fff;
  cursor: pointer;
  font: 700 13px/1 "SFMono-Regular", Menlo, "Cascadia Code", Consolas, monospace;
}
.guide-bot__form button:hover { background: #006b59; }
.guide-bot__privacy { margin: 0; padding: 0 17px 10px; background: #fff; color: #626a6d; font-size: 10px; line-height: 1.2; }
.guide-bot__panel.is-compact .guide-bot__starters { display: none; }
.guide-bot__panel.is-compact .guide-bot__header { align-items: center; padding: 10px 14px; }
.guide-bot__panel.is-compact .guide-bot__eyebrow { display: none; }
.guide-bot__panel.is-compact .guide-bot__header h2 { margin-top: 0; }
.guide-bot__panel.is-tiny .guide-bot__header { padding: 4px 10px; }
.guide-bot__panel.is-tiny .guide-bot__header h2 { font-size: 16px; }
.guide-bot__panel.is-tiny .guide-bot__description { display: none; }
.guide-bot__panel.is-tiny .guide-bot__messages { padding: 4px 10px; }
.guide-bot__panel.is-tiny .guide-bot__form { padding: 6px 10px; }
@media (max-width: 680px) {
  .guide-bot { left: 16px; top: auto; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); filter: drop-shadow(0 5px 10px rgba(15, 23, 42, .2)); }
  body.guide-bot-open { overflow: hidden; }
  .guide-bot__backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 85; display: block; padding: 0; border: 0; background: rgba(7, 10, 11, .35); }
  .guide-bot__panel { width: calc(100vw - 32px); border-radius: 20px; transform-origin: center bottom; }
  .guide-bot__close { flex: 0 0 auto; width: 40px; height: 40px; }
  .guide-bot__messages { max-height: none; padding: 14px; }
  .guide-bot__message { max-width: 96%; font-size: 14px; line-height: 1.7; }
  .guide-bot__starters { max-height: none; flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 10px 14px; scrollbar-width: none; }
  .guide-bot__starters button { flex: 0 0 auto; min-height: 40px; font-size: 13px; white-space: nowrap; }
  .guide-bot__form { padding: 12px 14px 14px; }
  .guide-bot__form input { min-height: 44px; font-size: 16px; }
  .guide-bot__form button { min-height: 44px; font-size: 13px; }
}
@media (prefers-reduced-motion: no-preference) {
  .guide-bot { animation: guide-float 6s ease-in-out infinite; }
  .guide-bot.is-dragging, .guide-bot.is-open { animation-play-state: paused; }
  .guide-bot__launcher { animation: guide-pulse 2.8s ease-in-out infinite; }
  .guide-bot__face::before { animation: guide-blink 5s ease-in-out infinite; }
  .guide-bot__panel { animation: guide-pop 190ms ease; }
  @keyframes guide-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
  @keyframes guide-pulse {
    0%, 100% { box-shadow: 0 12px 24px rgba(15, 23, 42, .2), 0 0 20px rgba(78, 168, 255, .35); transform: scale(1); }
    50% { box-shadow: 0 16px 28px rgba(15, 23, 42, .28), 0 0 26px rgba(78, 168, 255, .45); transform: scale(1.05); }
  }
  @keyframes guide-blink {
    0%, 90%, 100% { transform: translate(calc(var(--eye-x, 0px) + var(--eye-pair-center-x)), var(--eye-y, 0px)) scaleY(1); }
    94% { transform: translate(calc(var(--eye-x, 0px) + var(--eye-pair-center-x)), var(--eye-y, 0px)) scaleY(.2); }
    96% { transform: translate(calc(var(--eye-x, 0px) + var(--eye-pair-center-x)), var(--eye-y, 0px)) scaleY(.05); }
  }
  @keyframes guide-pop { from { opacity: 0; transform: scale(.97) translateY(4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
}
