/* ============================================
   壤製所｜網站標記工具 v3
   - 上下分割（2/3 網頁 + 1/3 編輯）
   - 元素級點擊 + hover 外框預覽
   - 批次管理（命名 + 自動存檔 + 紀錄面板）
   - Word 檔輸出 + email 送出
   ============================================ */

/* ─────────────────────────────────────────
   1. 全域：v3 編輯模式 = 上下 grid
   ───────────────────────────────────────── */
/* v9.1 修正：編輯模式下隱藏網站 nav / footer / floating-cta，避免擋住 topbar */
body[data-ann-mode] .nav,
body[data-ann-mode] #site-header,
body[data-ann-mode] #site-footer,
body[data-ann-mode] .floating-cta { display: none !important; }

body[data-ann-mode="edit"] {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 52px 1fr;
  grid-template-areas:
    "topbar"
    "main";
  background: #1A1410;
  font-family: var(--font-sans, "Noto Sans TC", sans-serif);
}

body[data-ann-mode="code"] {
  padding-top: 52px;
}

/* ─────────────────────────────────────────
   2. 頂部 Topbar
   ───────────────────────────────────────── */
.ann-topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: linear-gradient(135deg, #4A6324, #5F7E2E);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  z-index: 100;
  font-size: 0.875rem;
  gap: 0.5rem;
}
body[data-ann-mode="code"] .ann-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
}

.ann-topbar-left,
.ann-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.ann-topbar-badge {
  background: rgba(255, 255, 255, 0.18);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.ann-batch-name {
  background: rgba(178, 58, 44, 0.85);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ann-batch-name:hover { background: rgba(178, 58, 44, 1); }

.ann-topbar select,
.ann-topbar button {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.32);
  padding: 0.4rem 0.875rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  cursor: pointer;
  font-family: inherit;
}
.ann-topbar select { padding-right: 1.5rem; max-width: 180px; }
.ann-topbar button:hover,
.ann-topbar select:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* ─────────────────────────────────────────
   3. 主區（網頁 + 編輯區）
   ───────────────────────────────────────── */
.ann-main {
  grid-area: main;
  display: grid;
  grid-template-rows: 2fr 1fr;
  overflow: hidden;
}

.ann-stage {
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  position: relative;
  scroll-behavior: smooth;
}

.ann-editor {
  overflow-y: auto;
  background: #f8f5f0;
  border-top: 3px solid #5F7E2E;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
  position: relative;
}

/* 兩區之間的分隔抓手（讓使用者拉伸） */
.ann-resizer {
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 12px;
  cursor: row-resize;
  z-index: 20;
}
.ann-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 4px;
  background: rgba(95, 126, 46, 0.4);
  border-radius: 2px;
}

/* ─────────────────────────────────────────
   4. 代碼徽章（hover 區塊顯示）
   ───────────────────────────────────────── */
body[data-ann-mode] [data-code] {
  position: relative;
}

body[data-ann-mode] [data-code]::before {
  content: attr(data-code) !important;
  position: absolute !important;
  top: 6px !important;
  left: 6px !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  height: auto !important;
  background: rgba(178, 58, 44, 0.9) !important;
  color: #fff !important;
  font-family: ui-monospace, "SF Mono", Menlo, monospace !important;
  font-size: 0.6875rem !important;
  font-weight: 700 !important;
  padding: 0.2rem 0.5rem !important;
  border-radius: 4px !important;
  z-index: 10 !important;
  pointer-events: none !important;
  opacity: 0.6;
  display: inline-block !important;
  border: none !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  letter-spacing: 0.04em;
}

body[data-ann-mode="edit"] [data-code]:hover::before {
  opacity: 1;
}

/* ─────────────────────────────────────────
   5. 元素級點擊（v3 核心）
   ───────────────────────────────────────── */
body[data-ann-mode="edit"] [data-elt-id] {
  cursor: pointer;
  transition: background-color 0.12s, outline-color 0.12s;
  position: relative;
}

/* hover：淡綠虛線外框 */
body[data-ann-mode="edit"] [data-elt-id]:hover {
  outline: 2px dashed rgba(95, 126, 46, 0.7);
  outline-offset: 2px;
  background: rgba(95, 126, 46, 0.04);
}

/* hover 時顯示「元素類型」小標 */
body[data-ann-mode="edit"] [data-elt-id]:hover::after {
  content: attr(data-elt-type);
  position: absolute;
  top: -22px;
  right: 6px;
  background: #5F7E2E;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px 4px 4px 0;
  z-index: 15;
  pointer-events: none;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* 選中：實線綠色 + 高亮 */
body[data-ann-mode="edit"] [data-elt-id].ann-selected {
  outline: 3px solid #5F7E2E;
  outline-offset: 2px;
  background: rgba(95, 126, 46, 0.1);
}

/* 已標記過：紅色虛線 + 紅色 pin */
body[data-ann-mode="edit"] [data-elt-id].ann-marked {
  outline: 2px dotted rgba(178, 58, 44, 0.8);
  outline-offset: 2px;
}
body[data-ann-mode="edit"] [data-elt-id].ann-marked::before {
  content: '🔴';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 14px;
  z-index: 11;
  pointer-events: none;
}

/* 跳轉脈衝動畫 */
@keyframes annPulse {
  0%   { box-shadow: 0 0 0 0 rgba(95, 126, 46, 0.7); }
  100% { box-shadow: 0 0 0 30px rgba(95, 126, 46, 0); }
}
body[data-ann-mode="edit"] [data-elt-id].ann-pulse {
  animation: annPulse 1.2s ease-out;
}

/* 編輯模式下，連結 + 按鈕的滑鼠樣式統一 */
body[data-ann-mode="edit"] a,
body[data-ann-mode="edit"] button {
  cursor: pointer !important;
}

/* ─────────────────────────────────────────
   6. 編輯區內容（下方 1/3）
   ───────────────────────────────────────── */
.ann-editor-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

/* 空狀態 */
.ann-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: #6b4423;
}
.ann-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}
.ann-empty-text {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.ann-empty-hint {
  font-size: 0.8125rem;
  color: #8b7355;
}

/* 編輯卡片（選中元素時顯示） */
.ann-edit-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 1080px;
}

.ann-edit-info {
  background: #fff;
  border-radius: 10px;
  padding: 0.875rem 1rem;
  border-left: 4px solid #5F7E2E;
}
.ann-edit-info-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.ann-edit-info-code {
  background: #5F7E2E;
  color: #fff;
  font-family: ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.ann-edit-info-type {
  background: #B23A2C;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.ann-edit-info-preview {
  font-size: 0.8125rem;
  color: #553719;
  line-height: 1.5;
  margin-top: 0.375rem;
  max-height: 4rem;
  overflow-y: auto;
  background: #f8f5f0;
  padding: 0.5rem 0.625rem;
  border-radius: 6px;
  border: 1px dashed #c8b190;
}

.ann-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ann-field {
  display: flex;
  flex-direction: column;
}
.ann-field label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #3D2817;
  margin-bottom: 0.2rem;
}
.ann-field textarea,
.ann-field input[type="text"],
.ann-field input[type="url"],
.ann-field select {
  padding: 0.4rem 0.625rem;
  border: 1.5px solid #c8b190;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  background: #fff;
  color: #231811;
  resize: vertical;
}
.ann-field textarea { min-height: 50px; }
.ann-field textarea:focus,
.ann-field input:focus,
.ann-field select:focus {
  outline: none;
  border-color: #5F7E2E;
}

.ann-radios {
  display: flex;
  gap: 0.3rem;
}
.ann-radio {
  flex: 1;
  cursor: pointer;
}
.ann-radio input { display: none; }
.ann-radio span {
  display: block;
  text-align: center;
  padding: 0.35rem 0.4rem;
  border: 1.5px solid #c8b190;
  border-radius: 6px;
  font-size: 0.75rem;
  background: #fff;
}
.ann-radio input:checked + span {
  border-color: #5F7E2E;
  background: #f4f7ea;
  color: #3A4D1E;
  font-weight: 700;
}

.ann-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.ann-edit-actions button {
  flex: 1;
  padding: 0.55rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.ann-btn-cancel {
  background: #e0d3bd;
  color: #553719;
}
.ann-btn-confirm {
  background: #4A6324;
  color: #fff;
}
.ann-btn-confirm:hover { background: #3A4D1E; }

/* 自動存檔提示 */
.ann-autosave {
  position: fixed;
  bottom: 8px;
  right: 8px;
  background: rgba(74, 99, 36, 0.9);
  color: #fff;
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 100;
}
.ann-autosave.show { opacity: 1; }

/* ─────────────────────────────────────────
   7. Modal（批次命名、清單檢視、最終送出）
   ───────────────────────────────────────── */
.ann-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.ann-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.ann-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  transform: translateY(10px);
  transition: transform 0.22s;
  font-family: inherit;
}
.ann-modal-backdrop.open .ann-modal { transform: translateY(0); }

.ann-modal-head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e0d3bd;
  background: #f8f5f0;
}
.ann-modal-head h2 {
  font-family: var(--font-serif, "Noto Serif TC", serif);
  font-size: 1.25rem;
  margin: 0 0 0.25rem;
  color: #1A1410;
  font-weight: 900;
}
.ann-modal-head p {
  font-size: 0.8125rem;
  color: #6B4423;
  margin: 0;
}

.ann-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.ann-modal-foot {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0d3bd;
  background: #f8f5f0;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.ann-modal-foot button {
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  border: none;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.ann-modal-foot .secondary {
  background: #fff;
  color: #553719;
  border: 1.5px solid #c8b190;
}
.ann-modal-foot .primary {
  background: #B23A2C;
  color: #fff;
}
.ann-modal-foot .primary:hover { background: #9A2F23; }
.ann-modal-foot .neutral {
  background: #4A6324;
  color: #fff;
}
.ann-modal-foot .neutral:hover { background: #3A4D1E; }

/* 清單面板用 */
.ann-list-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #c8b190;
}
.ann-list-summary strong {
  font-family: var(--font-serif, serif);
  font-size: 1.5rem;
  color: #B23A2C;
}

.ann-page-group {
  margin-bottom: 1rem;
}
.ann-page-group-head {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #6b4423;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0.5rem 0 0.4rem;
}

.ann-item {
  background: #f8f5f0;
  border: 1px solid #e0d3bd;
  border-radius: 8px;
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: all 0.15s;
}
.ann-item:hover {
  border-color: #5F7E2E;
  background: #fff;
  transform: translateX(2px);
}
.ann-item-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}
.ann-item-code {
  background: #B23A2C;
  color: #fff;
  font-family: ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}
.ann-item-type {
  background: #5F7E2E;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}
.ann-item-urgency {
  font-size: 0.6875rem;
  font-weight: 700;
}
.ann-item-content {
  font-size: 0.8125rem;
  color: #231811;
  line-height: 1.5;
  margin-top: 0.25rem;
}
.ann-item-content .current {
  color: #8b7355;
  font-style: italic;
  font-size: 0.75rem;
}
.ann-item-meta {
  font-size: 0.6875rem;
  color: #8b7355;
  margin-top: 0.25rem;
}
.ann-item-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.ann-item-actions button {
  background: transparent;
  border: 1px solid #c8b190;
  color: #553719;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  cursor: pointer;
  font-family: inherit;
}
.ann-item-actions button:hover { background: #e0d3bd; }
.ann-item-actions .danger {
  border-color: #d99090;
  color: #B23A2C;
}

/* 批次命名輸入 */
.ann-batch-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1.125rem;
  border: 2px solid #c8b190;
  border-radius: 10px;
  font-family: inherit;
  text-align: center;
  margin-top: 1rem;
}
.ann-batch-input:focus {
  outline: none;
  border-color: #5F7E2E;
}

/* 送出選項勾選 */
.ann-send-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem;
  border: 1.5px solid #e0d3bd;
  border-radius: 10px;
  margin-bottom: 0.625rem;
  cursor: pointer;
  background: #fff;
}
.ann-send-option:hover { border-color: #5F7E2E; }
.ann-send-option input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: #5F7E2E;
  cursor: pointer;
}
.ann-send-option > span {
  flex: 1;
}
.ann-send-option strong {
  display: block;
  font-size: 0.9375rem;
  color: #231811;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.ann-send-option small {
  font-size: 0.75rem;
  color: #6b4423;
  line-height: 1.5;
}

/* ─────────────────────────────────────────
   8. 補圖 placeholder 按鈕（v3 新增）
   ───────────────────────────────────────── */
body[data-ann-mode="edit"] .ann-img-slot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.875rem;
  background: rgba(178, 58, 44, 0.1);
  border: 2px dashed #B23A2C;
  border-radius: 8px;
  color: #B23A2C;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0.5rem 0;
}
body[data-ann-mode="edit"] .ann-img-slot:hover {
  background: rgba(178, 58, 44, 0.2);
}

body:not([data-ann-mode]) .ann-img-slot,
body[data-ann-mode="code"] .ann-img-slot {
  display: none;
}

/* ─────────────────────────────────────────
   9. Toast 通知
   ───────────────────────────────────────── */
.ann-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1410;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-family: inherit;
  max-width: 90vw;
}
.ann-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.ann-toast.success { background: #4A6324; }
.ann-toast.error { background: #B23A2C; }
.ann-toast.info { background: #c4683a; }

/* ─────────────────────────────────────────
   10. 第一次使用引導 tooltip
   ───────────────────────────────────────── */
.ann-tour {
  position: fixed;
  z-index: 9998;
  background: #1a1410;
  color: #fff;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  max-width: 300px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  font-family: inherit;
}
.ann-tour h4 {
  margin: 0 0 0.4rem;
  font-size: 0.9375rem;
  color: #f4f7ea;
}
.ann-tour p {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #c8b190;
}
.ann-tour button {
  background: #5F7E2E;
  color: #fff;
  border: none;
  padding: 0.4rem 0.875rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  cursor: pointer;
  font-family: inherit;
}

/* ─────────────────────────────────────────
   11. 授權失敗
   ───────────────────────────────────────── */
.ann-auth-fail {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #B23A2C;
  color: #fff;
  padding: 1rem 1.25rem;
  text-align: center;
  z-index: 9999;
  font-family: inherit;
  font-size: 0.9375rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ─────────────────────────────────────────
   11.5 v10 框選範圍標註樣式
   ───────────────────────────────────────── */
/* 框選模式 cursor */
body[data-ann-framing="true"] .ann-stage,
body[data-ann-framing="true"] .ann-stage * {
  cursor: crosshair !important;
}
/* 框選模式下 hover 不再顯示元素 outline（避免干擾） */
body[data-ann-framing="true"] [data-elt-id]:hover {
  outline: none !important;
  background: none !important;
}
body[data-ann-framing="true"] [data-elt-id]:hover::after { display: none; }

/* 框選中的元素（顯示綠色實邊框） */
.ann-frame-selected {
  outline: 2.5px solid #5F7E2E !important;
  outline-offset: 2px;
  background: rgba(95, 126, 46, 0.08) !important;
  position: relative;
}

/* 框選編輯卡內的「元素標籤」 */
.ann-frame-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: #F4F7EA;
  color: #4A6324;
  border: 1px solid #CDDB9F;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
}

/* topbar 框選按鈕 active 狀態 */
#ann-frame-btn[style*="5F7E2E"] {
  color: #fff !important;
  border-color: #4A6324 !important;
}

/* ─────────────────────────────────────────
   12. 響應式（v8 改造：平板 + 手機）
   ───────────────────────────────────────── */

/* 平板（768-1023px）：保留上下分割但讓編輯卡單欄 */
@media (max-width: 1023px) {
  .ann-edit-card { grid-template-columns: 1fr; gap: 1rem; }
  .ann-editor-inner { padding: 1.25rem; }
}

/* 手機（< 768px）：完全重設 layout — 編輯卡改為「底部抽屜」 */
@media (max-width: 767px) {
  /* topbar 縮成 44px，按鈕加大成可觸控目標 */
  body[data-ann-mode="edit"] {
    grid-template-rows: 44px 1fr;
  }
  .ann-topbar {
    font-size: 0.75rem;
    padding: 0 0.5rem;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ann-topbar::-webkit-scrollbar { display: none; }
  .ann-topbar-badge {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    flex-shrink: 0;
  }
  .ann-topbar select,
  .ann-topbar button {
    font-size: 0.75rem;
    padding: 0.5rem 0.625rem;
    min-height: 36px;  /* 觸控目標 */
    flex-shrink: 0;
  }
  .ann-batch-name { max-width: 100px; font-size: 0.6875rem; }

  /* v9 修正：editor 回到 grid item（不再 fixed，避免擋住 topbar） */
  /* 主區 stage : editor = 1.5 : 1 */
  .ann-main {
    grid-template-rows: 1.5fr 1fr;
  }
  /* editor 保持自然流，不 fixed，topbar 自由可點 */
  .ann-editor {
    position: relative;
    background: var(--paper, #FBF8F2);
    border-top: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    z-index: 1;
  }
  /* stage 自己 scroll，避免擠壓 */
  .ann-stage {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .ann-editor-inner {
    padding: 1.5rem 1rem 1rem;
    overflow-y: auto;
    height: 100%;
    -webkit-overflow-scrolling: touch;
  }

  /* 所有按鈕至少 44px 高（Apple HIG / Material Design 觸控標準） */
  .ann-edit-card button,
  .ann-edit-card .ann-action-btn,
  .ann-modal button {
    min-height: 44px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
  }
  .ann-edit-card input[type="text"],
  .ann-edit-card textarea {
    font-size: 16px;  /* 16px 避免 iOS Safari 自動縮放 */
    min-height: 44px;
    padding: 0.75rem;
  }
  .ann-edit-card textarea { min-height: 80px; }

  /* Modal 全螢幕 */
  .ann-modal {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    border-radius: 0;
    inset: 0;
  }
  .ann-modal-backdrop { padding: 0; }
}

/* 觸控裝置（含平板）優化：按鈕加大、hover 改 active */
@media (hover: none) and (pointer: coarse) {
  .ann-topbar button { min-height: 40px; }
  .ann-edit-card button { min-height: 44px; }
}
