/* 妙观空间 · AI 文化助手
   配色沿用主站 tokens（style.css :root），此处写死以保证组件独立可用：
   ink#141815  brand#1e4a3e  gold#c2a062  cinnabar#a8443a  bg#fbfaf7  line#dcd7cd */

.mgai-fab {
  position: fixed; left: 22px; bottom: 26px; z-index: 200;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid #a8443a;
  background: #a8443a; color: #fff;
  font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(168, 68, 58, .28);
  transition: transform .25s ease, box-shadow .25s ease;
  padding: 0;
}
.mgai-fab:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(168, 68, 58, .36); }
.mgai-fab__dot {
  position: absolute; top: -1px; right: -1px; width: 10px; height: 10px;
  border-radius: 50%; background: #4caf50; border: 2px solid #fff;
}

.mgai-panel {
  position: fixed; left: 22px; bottom: 88px; z-index: 201;
  width: 380px; max-height: 74vh; height: 560px;
  display: flex; flex-direction: column;
  background: #fbfaf7; border: 1px solid #dcd7cd;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(20, 24, 22, .22);
  opacity: 0; visibility: hidden; transform: translateY(12px) scale(.98);
  transition: .25s ease; transform-origin: left bottom;
}
.mgai-panel.is-open { opacity: 1; visibility: visible; transform: none; }

.mgai-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: #1e4a3e; color: #fff; flex: none;
}
.mgai-head__t { font-size: 15px; font-weight: 500; letter-spacing: .04em; flex: 1; }
.mgai-head__s { font-size: 11px; opacity: .66; letter-spacing: .06em; }
.mgai-close {
  background: none; border: 0; color: #fff; opacity: .8;
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.mgai-close:hover { opacity: 1; }

.mgai-body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: #fbfaf7;
  scrollbar-width: thin;
}
.mgai-body::-webkit-scrollbar { width: 6px; }
.mgai-body::-webkit-scrollbar-thumb { background: rgba(35, 82, 63, .18); border-radius: 3px; }

.mgai-msg { max-width: 84%; line-height: 1.75; font-size: 13.5px; word-break: break-word; }
.mgai-msg p { margin: 0 0 8px; }
.mgai-msg p:last-child { margin-bottom: 0; }
.mgai-msg strong { font-weight: 600; }

.mgai-msg--ai {
  align-self: flex-start; background: #fff; color: #26302c;
  border: 1px solid #e9e5dc;
  padding: 10px 13px; border-radius: 12px 12px 12px 3px;
}
.mgai-msg--me {
  align-self: flex-end; background: #1e4a3e; color: #fff;
  padding: 10px 13px; border-radius: 12px 12px 3px 12px;
}
.mgai-msg--err {
  align-self: center; background: rgba(168, 68, 58, .08); color: #a8443a;
  border: 1px solid rgba(168, 68, 58, .22);
  padding: 8px 12px; border-radius: 10px; font-size: 12.5px; text-align: center;
}

.mgai-typing { display: inline-flex; gap: 4px; align-items: center; height: 14px; }
.mgai-typing i {
  width: 5px; height: 5px; border-radius: 50%; background: #1e4a3e;
  opacity: .4; animation: mgai-blink 1.2s infinite;
}
.mgai-typing i:nth-child(2) { animation-delay: .2s; }
.mgai-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes mgai-blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.mgai-quick { display: flex; flex-wrap: wrap; gap: 7px; }
.mgai-quick button {
  background: transparent; border: 1px solid #dcd7cd;
  color: #1e4a3e; border-radius: 999px;
  padding: 6px 11px; font-size: 12px; cursor: pointer; transition: .2s;
}
.mgai-quick button:hover { background: #1e4a3e; color: #fff; border-color: #1e4a3e; }

.mgai-foot { flex: none; padding: 11px 13px; border-top: 1px solid #e9e5dc; background: #fff; }
.mgai-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.mgai-inputrow textarea {
  flex: 1; resize: none; border: 1px solid #dcd7cd;
  border-radius: 9px; padding: 9px 11px; font-size: 13.5px; line-height: 1.5;
  font-family: inherit; max-height: 96px; outline: none; background: #fff;
}
.mgai-inputrow textarea:focus { border-color: #1e4a3e; }
.mgai-send {
  flex: none; width: 38px; height: 38px; border-radius: 9px; cursor: pointer;
  border: 1px solid #a8443a; background: #a8443a; color: #fff;
  font-size: 14px; display: flex; align-items: center; justify-content: center; padding: 0;
}
.mgai-send:disabled { opacity: .45; cursor: not-allowed; }
.mgai-hint { margin-top: 7px; font-size: 11px; color: #8b9490; text-align: center; letter-spacing: .03em; }

@media (max-width: 640px) {
  .mgai-fab { left: 16px; bottom: 18px; }
  .mgai-panel {
    left: 12px; right: 12px; width: auto; bottom: 76px;
    height: 66vh; max-height: 66vh;
  }
}
