.ai-help-shell,
.ai-help-shell * { box-sizing: border-box; }

.ai-help-launcher {
  position: fixed;
  right: 22px;
  bottom: 10px;
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 15px 10px 10px;
  border: 2px solid #17130f;
  border-radius: 18px;
  background: #ff4b18;
  color: #fff;
  box-shadow: 7px 7px 0 #ffd83d;
  font: 800 15px/1.1 system-ui, -apple-system, "Noto Sans TC", sans-serif;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.ai-help-launcher:hover,
.ai-help-launcher:focus-visible { transform: translate(-2px, -2px); box-shadow: 10px 10px 0 #ffd83d; }
.ai-help-launcher small { padding: 4px 6px; border-radius: 999px; background: #17130f; color: #ffd83d; font-size: 9px; letter-spacing: .08em; }
.ai-help-spark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #17130f; color: #ffd83d; font-size: 20px; }

.ai-help-panel {
  position: fixed;
  right: 22px;
  bottom: 82px;
  z-index: 9998;
  width: min(410px, calc(100vw - 32px));
  height: min(650px, calc(100dvh - 122px));
  min-height: 480px;
  overflow: hidden;
  border: 2px solid #17130f;
  border-radius: 24px;
  background: #fffaf0;
  color: #17130f;
  box-shadow: 11px 11px 0 rgba(23, 19, 15, .18);
  font-family: system-ui, -apple-system, "Noto Sans TC", "Noto Sans Thai", sans-serif;
  animation: ai-help-in .18s ease-out;
}

.ai-help-panel[hidden] { display: none !important; }
@keyframes ai-help-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.ai-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px 14px;
  background: #17130f;
  color: #fff;
}
.ai-help-header > div { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ai-help-header p { display: grid; gap: 3px; margin: 0; min-width: 0; }
.ai-help-header b { font-size: 16px; }
.ai-help-header small { overflow: hidden; color: #d8d1c6; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.ai-help-avatar { display: grid; place-items: center; flex: 0 0 43px; width: 43px; height: 43px; border-radius: 14px; background: #ff4b18; color: #fff; border: 2px solid #ffd83d; font-size: 14px; font-weight: 900; }
.ai-help-close { width: 38px; height: 38px; border: 0; border-radius: 12px; background: #312a24; color: #fff; font-size: 27px; line-height: 1; cursor: pointer; }
.ai-help-close:hover,
.ai-help-close:focus-visible { background: #ff4b18; }

.ai-help-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #d9d1c4; background: #ffd83d; }
.ai-help-tools label { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.ai-help-tools select { max-width: 145px; padding: 6px 25px 6px 8px; border: 1px solid #17130f; border-radius: 8px; background: #fff; color: #17130f; font-family: inherit; font-size: 12px; font-weight: 700; line-height: 1.2; }
.ai-help-private { font-size: 9px; font-weight: 900; letter-spacing: .06em; white-space: nowrap; }
.ai-help-private::first-letter { color: #168354; }

.ai-help-messages { height: calc(100% - 261px); min-height: 190px; overflow-y: auto; padding: 14px; overscroll-behavior: contain; scroll-behavior: smooth; }
.ai-help-message { max-width: 88%; margin: 0 0 10px; padding: 11px 13px; border: 1px solid #cfc5b6; border-radius: 16px 16px 16px 4px; background: #fff; box-shadow: 2px 2px 0 rgba(23,19,15,.08); font-size: 13px; line-height: 1.62; }
.ai-help-message p { margin: 0; }
.ai-help-user { margin-left: auto; border-color: #17130f; border-radius: 16px 16px 4px 16px; background: #17130f; color: #fff; }
.ai-help-notice { max-width: 100%; border-style: dashed; border-color: #e48f75; background: #fff2eb; color: #71301c; font-size: 11px; }
.ai-help-next-label { display: block; margin-top: 10px; color: #5d5147; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.ai-help-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; padding-top: 8px; border-top: 1px solid #e7ded0; }
.ai-help-links a { padding: 5px 8px; border: 1px solid #bdb1a1; border-radius: 999px; color: #412d24; font-size: 10px; font-weight: 800; text-decoration: none; }
.ai-help-links a:hover,
.ai-help-links a:focus-visible { border-color: #ff4b18; color: #d93406; }
.ai-help-links .ai-help-line { border-color: #087b50; background: #0aa36c; color: #fff; }
.ai-help-links .ai-help-action { border-color: #17130f; background: #ff4b18; color: #fff; box-shadow: 2px 2px 0 #ffd83d; }
.ai-help-links .ai-help-action:hover,
.ai-help-links .ai-help-action:focus-visible { border-color: #17130f; background: #17130f; color: #ffd83d; }

.ai-help-choice-message { max-width: 96%; }
.ai-help-choices { display: grid; gap: 7px; margin-top: 10px; }
.ai-help-choice { width: 100%; padding: 9px 11px; border: 1px solid #17130f; border-radius: 11px; background: #fff8e6; color: #2f251f; font-family: inherit; font-size: 11px; font-weight: 900; line-height: 1.35; text-align: left; cursor: pointer; }
.ai-help-choice::after { content: "→"; float: right; color: #e53b0d; }
.ai-help-choice:hover,
.ai-help-choice:focus-visible { background: #ffd83d; color: #17130f; outline: 2px solid rgba(255,75,24,.18); }
.ai-help-choice:disabled { border-color: #d7cdbc; background: #f2eee8; color: #8b8176; cursor: default; opacity: .7; }
.ai-help-choice:disabled::after { color: inherit; }

.ai-help-quick { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 10px; scrollbar-width: thin; }
.ai-help-quick button { flex: 0 0 auto; max-width: 220px; padding: 7px 9px; border: 1px solid #ccbdac; border-radius: 999px; background: #fff; color: #4b3b31; font-family: inherit; font-size: 11px; font-weight: 700; line-height: 1.25; cursor: pointer; }
.ai-help-quick button:hover,
.ai-help-quick button:focus-visible { border-color: #ff4b18; background: #fff1eb; color: #b52d08; }

.ai-help-form { display: grid; grid-template-columns: 1fr auto; align-items: stretch; gap: 8px; padding: 10px 12px; border-top: 1px solid #d9d1c4; background: #fff; }
.ai-help-form textarea { width: 100%; min-height: 48px; max-height: 88px; resize: none; padding: 10px 11px; border: 1px solid #aa9c8c; border-radius: 12px; background: #fffdf9; color: #17130f; font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1.45; }
.ai-help-form textarea:focus { border-color: #ff4b18; outline: 2px solid rgba(255,75,24,.16); }
.ai-help-form button { min-width: 58px; border: 2px solid #17130f; border-radius: 12px; background: #ff4b18; color: #fff; font-family: inherit; font-size: 12px; font-weight: 900; line-height: 1; cursor: pointer; }
.ai-help-form button:hover,
.ai-help-form button:focus-visible { background: #17130f; color: #ffd83d; }
.ai-help-disclaimer { min-height: 42px; margin: 0; padding: 4px 13px 9px; background: #fff; color: #75685c; font-size: 9px; line-height: 1.45; }
.ai-help-shell .sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 680px) {
  .ai-help-launcher { right: 14px; bottom: 70px; width: 48px; min-height: 48px; padding: 5px; gap: 0; border-radius: 15px; box-shadow: 4px 4px 0 #ffd83d; }
  .ai-help-spark { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; font-weight: 900; }
  .ai-help-launcher b,
  .ai-help-launcher small { display: none; }
  .ai-help-panel { inset: 10px 10px 74px; width: auto; height: auto; min-height: 0; border-radius: 20px; }
  .ai-help-messages { height: calc(100% - 260px); }
  body.ai-help-open { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-help-panel { animation: none; }
  .ai-help-launcher { transition: none; }
  .ai-help-messages { scroll-behavior: auto; }
}

@media print {
  .ai-help-shell { display: none !important; }
}
