/* 背景遮罩（初始為隱藏狀態，用 opacity/visibility 動畫） */
.au-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;                /* 改為固定 flex，靠 visibility 控制互動性 */
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 24px;
  box-sizing: border-box;

  /* 初始：不可見、不可互動（避免一閃而過） */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  /* 淡入淡出動畫 */
  transition:
	opacity .28s ease,
	visibility 0s linear .28s;  /* 淡出結束後才把 visibility 設為 hidden */
}

/* 開啟時：可見、可互動 */
.au-modal-overlay.au-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
	opacity .28s ease,
	visibility 0s linear 0s;    /* 立刻可見 */
}

/* 外層盒：允許溢出，好讓關閉鍵可浮在外側 */
.au-modal-box {
  position: relative;
  width: min(92vw, 720px);
  max-height: 86vh;
  overflow: visible;
}

/* 內層表面（內容容器） */
.au-modal-surface {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  overflow: hidden;

  /* 進場動畫（微縮放與位移） */
  transform: translateY(8px) scale(0.98);
  transition: transform .28s ease;
}
/* overlay 開啟時，內容平滑到位 */
.au-modal-overlay.au-open .au-modal-surface {
  transform: translateY(0) scale(1);
}

/* 可滾動內容 */
.au-modal-content {
  padding: clamp(16px, 2.4vw, 24px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.au-modal-content,
.au-modal-content * {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.au-modal-content img,
.au-modal-content video,
.au-modal-content iframe {
  max-width: 100%;
  height: auto;
}

.au-modal-content h3 {
  margin: 0 0 12px;
  font-size: 1.2em;
  line-height: 1.3;
  color: #F60;
}

.au-modal-content p,
.au-modal-content li {
  line-height: 1.7;
  margin: 0 0 10px;
  color: #000;
}

/* 精緻版關閉按鈕（純 CSS 畫 X） */
.au-close-btn {
  position: absolute;
  top: -18px;
  right: -18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #000;
  border: 2px solid rgba(255,255,255,0.7);
  box-shadow: 0 8px 18px rgba(0,0,0,0.55);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
  z-index: 1;
  color: transparent; /* 隱藏字元 &times; 的視覺呈現（保留給輔助工具） */
}

.au-close-btn::before,
.au-close-btn::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 0.5px rgba(255,255,255,0.6);
}
.au-close-btn::before { transform: rotate(45deg); }
.au-close-btn::after  { transform: rotate(-45deg); }

.au-close-btn:hover {
  background-color: #242424;
  border-color: rgba(255,255,255,0.9);
  transform: scale(1.08);
  box-shadow: 0 10px 22px rgba(0,0,0,0.6);
}
.au-close-btn:active {
  transform: scale(0.96);
  box-shadow: 0 6px 14px rgba(0,0,0,0.55);
}
.au-close-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.95);
  outline-offset: 2px;
}

/* 手機：把按鈕移到白框內角並縮小 */
@media (max-width: 480px) {
  .au-close-btn {
	top: 8px;
	right: 8px;
	width: 30px;
	height: 30px;
	border-width: 1.5px;
	box-shadow: 0 6px 14px rgba(0,0,0,0.5);
  }
  .au-close-btn::before,
  .au-close-btn::after {
	width: 15px;
	height: 2px;
  }
}

/* 開啟 modal 時禁用背景滾動 */
body.au-modal-open {
  height: 100vh;
  overflow: hidden;
  position: relative;
}
</style>