/* 全畫面標註。高於上方列與工具（5000），低於 #layer 的對話框、選單、提示條（6000）。 */
.an-root { position: fixed; inset: 0; z-index: 5500; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; animation: an-in 0.16s ease-out; }
.an-root[hidden], .an-root [hidden] { display: none !important; }
@keyframes an-in { from { opacity: 0; } to { opacity: 1; } }

/* 疊放順序：遮幕 < 筆跡 < 即時層 < 雷射 < 聚光燈 < 遮幕拉把 < 工具列 */
.an-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.an-main { z-index: 2; pointer-events: none; }
.an-live { z-index: 3; touch-action: none; cursor: crosshair; }
.an-laser { z-index: 4; pointer-events: none; }
.an-root[data-tool="eraser"] .an-live { cursor: cell; }
.an-root[data-tool="laser"] .an-live, .an-root[data-tool="spotlight"] .an-live { cursor: none; }

/* ---- 聚光燈：整片變暗，只留指標附近一個圓 ---- */
.an-spot { position: absolute; inset: 0; z-index: 5; pointer-events: none; --x: 50%; --y: 50%; --r: 200px; background: radial-gradient(circle var(--r) at var(--x) var(--y), transparent calc(100% - 14px), rgba(255, 255, 255, 0.28) calc(100% - 3px), rgba(8, 8, 8, 0.82) 100%); }

/* ---- 遮幕：由上往下拉開 ---- */
.an-curtain { position: absolute; left: 0; right: 0; bottom: 0; top: 0; z-index: 1; pointer-events: none; background-color: #23211e; background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 34px), linear-gradient(rgba(0, 0, 0, 0.35), transparent 28px); box-shadow: 0 -2px 0 rgba(255, 255, 255, 0.25), 0 -18px 30px -12px rgba(0, 0, 0, 0.45); }
.an-pull { position: absolute; left: 50%; top: 12px; z-index: 6; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; min-height: 52px; min-width: 52px; padding: 0 20px 0 14px; border-radius: 999px; background: #fbfaf7; color: #141414; font: 600 1.0625rem/1.2 var(--font, system-ui); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.6); cursor: ns-resize; touch-action: none; white-space: nowrap; }
.an-pull:focus-visible { outline: 3px solid var(--acc, #2848b8); outline-offset: 3px; }
.an-pull .ic { color: var(--acc, #2848b8); }

/* ---- 工具列：深色浮動，任何底色上都看得清楚 ---- */
.an-tb { position: absolute; z-index: 7; display: grid; gap: 4px; padding: 6px; background: rgba(24, 23, 21, 0.92); color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 18px; box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.65); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; touch-action: none; }
.an-tb.an-v { grid-template-columns: repeat(2, 48px); grid-auto-flow: row; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); touch-action: pan-y; }
.an-tb.an-h { grid-template-rows: repeat(2, 48px); grid-auto-flow: column; max-width: calc(100vw - 16px); touch-action: pan-x; }
.an-tb.an-dragging, .an-fab.an-dragging { box-shadow: 0 26px 60px -16px rgba(0, 0, 0, 0.75); }
.an-sep { background: rgba(255, 255, 255, 0.16); }
.an-v .an-sep { grid-column: 1 / -1; height: 1px; margin: 3px 4px; }
.an-h .an-sep { grid-row: 1 / -1; width: 1px; margin: 4px 3px; }

.an-btn { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border: 2px solid transparent; border-radius: 13px; background: none; color: #fff; }
.an-btn:hover { background: rgba(255, 255, 255, 0.14); }
.an-btn:active { background: rgba(255, 255, 255, 0.22); }
.an-btn[aria-pressed="true"] { background: #fff; color: #141414; }
.an-btn:disabled { opacity: 0.32; cursor: default; background: none; }
.an-btn:focus-visible, .an-fab:focus-visible { outline: 3px solid #8fa8ff; outline-offset: 1px; }
.an-grip { cursor: grab; touch-action: none; color: rgba(255, 255, 255, 0.75); }
.an-tb.an-dragging .an-grip { cursor: grabbing; }
.an-close { color: #ffb4ab; }
.an-close:hover { background: rgba(214, 69, 51, 0.3); color: #fff; }

/* 色票：按下時外圈白框，不靠底色變化（黑、白都要看得出來） */
.an-color[aria-pressed="true"] { background: none; border-color: #fff; }
.an-sw { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
.an-color[aria-pressed="true"] .an-sw { width: 32px; height: 32px; }
.an-dot { border-radius: 50%; background: var(--an-color, #d64533); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.45); }
.an-light-ink .an-size[aria-pressed="true"] .an-dot { box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.55); }
.an-dot-0 { width: 7px; height: 7px; }
.an-dot-1 { width: 14px; height: 14px; }
.an-dot-2 { width: 24px; height: 24px; }
/* 聚光燈時大小鈕調的是燈的半徑，換成空心圈提示 */
.an-root[data-tool="spotlight"] .an-dot { background: none; box-shadow: inset 0 0 0 2px currentColor; }
.an-root[data-tool="spotlight"] .an-dot-0 { width: 12px; height: 12px; }
.an-root[data-tool="spotlight"] .an-dot-1 { width: 20px; height: 20px; }
.an-root[data-tool="spotlight"] .an-dot-2 { width: 30px; height: 30px; }

/* ---- 收合後的小按鈕（拖得動，點一下展開）---- */
.an-fab { position: absolute; z-index: 7; width: 60px; height: 60px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 50%; background: rgba(24, 23, 21, 0.92); color: #fff; box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7); cursor: grab; touch-action: none; }
.an-fab-dot { position: absolute; right: 9px; bottom: 9px; width: 14px; height: 14px; border-radius: 50%; background: var(--an-color, #d64533); box-shadow: 0 0 0 2px rgba(24, 23, 21, 0.92), 0 0 0 3px rgba(255, 255, 255, 0.5); }

@media (prefers-reduced-motion: reduce) {
  .an-root { animation: none; }
  .an-tb, .an-fab, .an-btn { transition: none; }
}
