:root {
  --gma-launcher-bottom: 170px;
  --gma-launcher-right: 30px;
}

#gma-cloud-launcher {
  position: fixed;
  right: var(--gma-launcher-right);
  bottom: var(--gma-launcher-bottom);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #ffcccc;
  box-shadow: 0 4px 16px rgba(216, 42, 62, .25);
  cursor: pointer;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease;
}
#gma-cloud-launcher:hover { transform: translateY(-2px); }
#gma-cloud-launcher img { width: 44px; height: 44px; display: block; }

#gma-cloud-panel {
  position: fixed;
  right: var(--gma-launcher-right);
  bottom: calc(var(--gma-launcher-bottom) + 66px);
  width: 360px;
  max-width: calc(100vw - 36px);
  height: min(520px, calc(100vh - var(--gma-launcher-bottom) - 90px));
  background: #fff;
  border: 1px solid #ffd9d9;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(216, 42, 62, .24);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #1f1f1f;
}
#gma-cloud-panel[hidden] { display: none; }

.gma-cloud-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #d72a3e;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.gma-cloud-head button {
  background: none;
  border: 0;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.gma-cloud-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: #fff0f0;
}
.gma-msg { margin-bottom: 12px; max-width: 88%; }
.gma-msg.bot { margin-right: auto; }
.gma-msg.user { margin-left: auto; }
.gma-msg-content {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}
.gma-msg.bot .gma-msg-content { background: #fff; border: 1px solid #ffd9d9; color: #222; }
.gma-msg.user .gma-msg-content { background: #ff0000; color: #fff; }
.gma-msg-content p { margin: 0 0 6px; }
.gma-msg-content p:last-child { margin-bottom: 0; }
.gma-msg-content ul, .gma-msg-content ol { margin: 6px 0; padding-left: 20px; }
.gma-msg-content a { color: #d72a3e; }
.gma-msg-time { margin-top: 4px; font-size: 11px; color: #999; }
.gma-msg.user .gma-msg-time { text-align: right; }
.gma-msg.typing .gma-msg-content { color: #888; font-style: italic; }

.gma-cloud-form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5e5e5;
  background: #fff;
}
.gma-cloud-form textarea {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.gma-cloud-form textarea:focus { border-color: #ff0000; }
.gma-cloud-form button {
  flex: 0 0 42px;
  border: 0;
  border-radius: 8px;
  background: #ff0000;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}
.gma-cloud-form button:disabled { background: #f0b9c0; cursor: default; }

@media (max-width: 600px) {
  :root { --gma-launcher-bottom: 70px; }
  #gma-cloud-panel {
    right: 10px;
    bottom: calc(var(--gma-launcher-bottom) + 66px);
    width: calc(100vw - 20px);
    height: min(60vh, calc(100vh - var(--gma-launcher-bottom) - 90px));
  }
  #gma-cloud-launcher { right: 12px; }
}
