/* shortcode 內嵌模式（不動） */
.aics-widget { width: 100%; height: 560px; }
.aics-widget iframe { width: 100%; height: 100%; border: 0; display: block; }

/* 舊版浮動 markup 的殘留規則（舊頁面快取時仍可運作） */
.aics-widget--bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  height: 560px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  z-index: 9999;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
@media (max-width: 480px) {
  .aics-widget--bubble { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100vh - 16px); }
}

/* 浮動 launcher + 面板 */
.aics-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
}
.aics-bubble--pending .aics-launcher { display: none; }
.aics-launcher {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--aics-primary, #2563eb);
  color: var(--aics-on-primary, #ffffff);
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}
.aics-launcher:hover { transform: scale(1.04); }
.aics-launcher:focus-visible { outline: 2px solid #111827; outline-offset: 3px; }
.aics-launcher[hidden] { display: none; }
.aics-launcher--caption {
  width: auto;
  padding: 0 18px;
  gap: 8px;
  border-radius: 28px;
}
.aics-launcher__icon { display: block; width: 26px; height: 26px; object-fit: contain; }
/* 圓形 launcher 的自訂圖示填滿整個按鈕；膠囊（有 caption）與預設 SVG 維持 26px。 */
.aics-launcher:not(.aics-launcher--caption) img.aics-launcher__icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.aics-launcher__caption {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .aics-launcher__caption { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
}

.aics-panel {
  position: fixed;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.aics-panel[hidden] { display: none; }
.aics-panel__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 6px 0 10px;
  background: var(--aics-primary, #2563eb);
  color: var(--aics-on-primary, #ffffff);
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.aics-panel--busy .aics-panel__bar { cursor: grabbing; }
.aics-panel__title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.aics-panel__title[hidden] { display: none; }
.aics-panel__actions { display: flex; gap: 2px; margin-left: auto; }
.aics-panel__btn {
  width: 26px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.aics-panel__btn:hover { background: rgba(255, 255, 255, .18); }
.aics-panel__btn:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.aics-panel__frame { position: relative; flex: 1; min-height: 0; }
.aics-panel__frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.aics-panel--busy .aics-panel__frame iframe { pointer-events: none; }
.aics-panel__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 16px;
  color: #555;
  text-align: center;
  background: #fff;
}
.aics-panel__fallback[hidden] { display: none; }
.aics-resize-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.aics-resize {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  background: transparent;
}
.aics-resize:focus-visible {
  outline: 2px solid var(--aics-primary, #2563eb);
  outline-offset: -2px;
}
.aics-resize[data-aics-resize="n"],
.aics-resize[data-aics-resize="s"] { left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.aics-resize[data-aics-resize="n"] { top: 0; }
.aics-resize[data-aics-resize="s"] { bottom: 0; }
.aics-resize[data-aics-resize="e"],
.aics-resize[data-aics-resize="w"] { top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.aics-resize[data-aics-resize="e"] { right: 0; }
.aics-resize[data-aics-resize="w"] { left: 0; }
.aics-resize[data-aics-resize="ne"],
.aics-resize[data-aics-resize="nw"],
.aics-resize[data-aics-resize="se"],
.aics-resize[data-aics-resize="sw"] { width: 14px; height: 14px; }
.aics-resize[data-aics-resize="ne"] { top: 0; right: 0; cursor: nesw-resize; }
.aics-resize[data-aics-resize="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.aics-resize[data-aics-resize="se"] { bottom: 0; right: 0; cursor: nwse-resize; }
.aics-resize[data-aics-resize="sw"] { bottom: 0; left: 0; cursor: nesw-resize; }
/* 右下角保留視覺握把（不影響命中區）。 */
.aics-resize[data-aics-resize="se"]::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  background: repeating-linear-gradient(135deg, #9ca3af 0 1px, transparent 1px 3px);
  opacity: .7;
}

@media (max-width: 640px) {
  .aics-bubble { right: 12px; bottom: 12px; }
  .aics-panel { min-width: 0; }
  .aics-resize,
  .aics-panel__btn[data-aics-maximize] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aics-launcher { transition: none; }
  .aics-launcher:hover { transform: none; }
}
