/* ============================================================================
 * 檔案名稱：css/draw.css（畫布繪圖與塗鴉白板專用樣式）
 * 對應腳本：draw.js
 * 載入順序：CSS 第 3 順位
 * ----------------------------------------------------------------------------
 * 【包含內容】
 *   1. 調色盤按鈕、預設色票、自訂取色器與歷史顏色列（.sn-color-panel）
 *   2. 筆刷粗細滑桿、幾何圖形選擇面板、繪圖工具按鈕高亮與觸控筆防誤觸狀態（.stylus-only-active）
 *   3. 畫布便利貼釘選圖示與彈出編輯框（Sticky Note Popover）、文字泡泡註解
 *   4. 橡皮擦游標動態光暈（.sn-eraser-ring）與選取物件浮動刪除按鈕
 *   5. 塗鴉白板彈窗（Drawing Modal：.drawing-modal-overlay / .drawing-toolbar-slot / .drawing-canvas-stage）
 * ============================================================================ */

/* 🎨 更多色彩與歷史顏色調色盤按鈕 */
.sn-color-picker-wrapper {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sn-color-preview-btn {
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    background-color: var(--ed-accent, #38bdf8);
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    outline: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.sn-color-preview-btn:hover {
    transform: scale(1.15) !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.7) !important;
}

.sn-color-preview-btn:active {
    transform: scale(0.95) !important;
}

.sn-color-preview-btn i {
    font-size: 11px !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7) !important;
    pointer-events: none !important;
}

/* 🎨 統一色彩浮層調色盤面板（掛載至 body，fixed 定位，JS 動態設定座標） */
.sn-color-panel {
    position: fixed;
    width: 280px;
    background: #131b2c;
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--ed-radius-lg, 12px);
    padding: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 15px var(--ed-accent-soft, rgba(56, 189, 248, 0.15));
    z-index: 300000 !important;
    display: none !important;
    backdrop-filter: blur(16px);
    box-sizing: border-box;
}

.sn-color-panel.open {
    display: block !important;
    animation: snFadeIn 0.2s ease-out;
}


@keyframes snFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.sn-color-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ed-text-muted, #94a3b8);
    margin-top: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sn-color-section-title:first-child {
    margin-top: 0;
}

.sn-color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 4px;
}

.sn-color-cell {
    width: 32px;
    height: 32px;
    border-radius: var(--ed-radius-md, 8px);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.sn-color-cell:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.sn-color-cell.active {
    border-color: #ffffff;
    transform: scale(1.12);
    box-shadow: 0 0 0 2px var(--ed-accent-strong, #00d9ff), 0 0 12px rgba(0, 217, 255, 0.8);
}

.sn-custom-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    background: rgba(15, 23, 42, 0.6);
    padding: 6px 10px;
    border-radius: var(--ed-radius-md, 8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sn-custom-color-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--ed-radius-sm, 6px);
    cursor: pointer;
    background: none;
    padding: 0;
}

.sn-custom-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.sn-custom-color-input::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--ed-radius-sm, 6px);
}

.sn-custom-hex-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--ed-text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    outline: none;
}

.sn-custom-save-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--ed-radius-sm, 6px);
    border: 1px solid var(--ed-border-strong, rgba(56, 189, 248, 0.35));
    background: var(--ed-accent-soft, rgba(56, 189, 248, 0.15));
    color: var(--ed-accent, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sn-custom-save-btn:hover {
    background: var(--ed-accent, #38bdf8);
    color: var(--ed-panel-bg, #0f172a);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
    transform: scale(1.08);
}


.sn-history-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    min-height: 32px;
}

.sn-history-dot {
    width: 32px;
    height: 32px;
    border-radius: var(--ed-radius-md, 8px);
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.sn-history-dot:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.sn-history-dot.active {
    border-color: #ffffff;
    transform: scale(1.12);
    box-shadow: 0 0 0 2px var(--ed-accent-strong, #00d9ff), 0 0 12px rgba(0, 217, 255, 0.8);
}

/* 🎨 色彩控制群組 */
.sn-color-group {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    position: relative !important;
    flex-shrink: 0 !important;
}

.sn-color-palette {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.sn-color-dot {
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    border: 2px solid transparent !important;
    transition: all 0.15s ease !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
}

.sn-color-dot:hover {
    transform: scale(1.15) !important;
}

.sn-color-dot.active {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 8px rgba(0, 0, 0, 0.5) !important;
    transform: scale(1.15) !important;
}

/* 🔘 筆刷粗細 (五種大小快捷選擇器) */
.sn-size-group {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    padding: 3px 6px !important;
    flex-shrink: 0 !important;
}


.sn-size-dot {
    border-radius: 50% !important;
    background-color: var(--ed-text-muted, #94a3b8) !important;
    transition: background-color 0.15s ease, transform 0.15s ease !important;
    display: block !important;
}

/* 🎨 選中文字懸浮快捷泡泡列 (Bubble Menu) */
.pdf-text-bubble-menu {
    position: fixed;
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(18, 24, 38, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--ed-border-strong);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.25);
    border-radius: 24px;
    padding: 5px 10px;
    z-index: 2147483646;
    transform: translate(-50%, -100%);
    animation: bubbleFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bubbleFadeIn {
    from { opacity: 0; transform: translate(-50%, -85%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

.sn-bubble-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    color: var(--ed-text, #e2e8f0);
    padding: 5px 9px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sn-bubble-btn:hover {
    background: var(--ed-border, rgba(255, 255, 255, 0.08));
    color: var(--ed-accent, #38bdf8);
    transform: translateY(-1px);
}

.sn-bubble-btn.highlight:hover {
    background: rgba(250, 204, 21, 0.2);
    color: #facc15;
}

.sn-bubble-btn.js-bubble-unhighlight:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}


/* 📌 便利貼註解浮動卡片 (Sticky Note Popover) */
.sn-sticky-popover {
    position: fixed;
    display: none;
    flex-direction: column;
    width: 280px;
    background: rgba(20, 27, 44, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--ed-border-strong);
    border-radius: var(--ed-radius-lg, 12px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7), 0 0 16px rgba(56, 189, 248, 0.2);
    z-index: 2147483647;
    padding: 12px;
    animation: popoverFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.sn-sticky-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.sn-sticky-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ed-accent, #38bdf8);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.sn-sticky-colors {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sn-sticky-color-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease;
    box-sizing: border-box;
}

.sn-sticky-color-dot:hover {
    transform: scale(1.25);
}

.sn-sticky-color-dot.active {
    border-color: #ffffff;
    box-shadow: 0 0 8px currentColor;
}

.sn-sticky-close-btn {
    background: transparent;
    border: none;
    color: var(--ed-text-muted, #94a3b8);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 5px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.sn-sticky-close-btn:hover {
    color: var(--ed-text, #e2e8f0);
    background: rgba(255, 255, 255, 0.1);
}

.sn-sticky-textarea {
    width: 100%;
    min-height: 85px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--ed-border, rgba(255, 255, 255, 0.08));
    border-radius: var(--ed-radius-sm, 6px);
    color: #f8fafc;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 8px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.sn-sticky-textarea:focus {
    border-color: var(--ed-accent, #38bdf8);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.sn-sticky-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--ed-border, rgba(255, 255, 255, 0.08));
}

.sn-sticky-del-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.sn-sticky-del-btn:hover {
    background: rgba(239, 68, 68, 0.15);
}

.sn-sticky-tip {
    font-size: 0.72rem;
    color: var(--ed-text-muted, #94a3b8);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 筆刷粗細面板樣式 */
.sn-size-panel {
    min-width: 260px;
}

.sn-size-indicator-dot {
    display: inline-block;
    border-radius: 50%;
    background-color: var(--ed-accent, #38bdf8);
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
    flex-shrink: 0;
}

.sn-size-trigger-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ed-text);
}

.sn-size-preset-row-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 12px;
}

.sn-size-preset-btn-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: var(--ed-radius-md, 8px);
    padding: 6px 4px;
    cursor: pointer;
    color: var(--ed-text-muted, #94a3b8);
    transition: all 0.15s ease;
    flex: 1;
}

.sn-size-preset-btn-v2:hover {
    background: var(--ed-border, rgba(255, 255, 255, 0.08));
    color: var(--ed-text);
}

.sn-size-preset-btn-v2.active {
    background: rgba(56, 189, 248, 0.18);
    border-color: var(--ed-accent, #38bdf8);
    color: var(--ed-accent, #38bdf8);
}

.sn-size-preset-btn-v2 .sn-size-dot {
    background: var(--ed-text-muted, #94a3b8);
    border-radius: 50%;
    transition: all 0.15s ease;
}

.sn-size-preset-btn-v2.active .sn-size-dot {
    background: var(--ed-accent, #38bdf8);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.sn-size-preset-btn-v2 .preset-name {
    font-size: 0.7rem;
    font-weight: 600;
}

.sn-size-slider-row {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: var(--ed-radius-md, 8px);
}

.sn-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--ed-text-muted, #94a3b8);
    margin-bottom: 8px;
}


.sn-size-slider {
    width: 100%;
    height: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--ed-border, rgba(255, 255, 255, 0.08));
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.sn-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ed-accent, #38bdf8);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.sn-size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ==========================================================================
   🎨 編輯器手繪與畫布專屬樣式 (Canvas & Paper CSS)
   包含：白板 Modal、畫布容器、底紙網格、橡皮擦指示圈、選中浮動垃圾桶、PDF 畫布舞台與文字層
   ========================================================================== */

/* =========================================================
   🎨 科技感手繪畫布與塗鴉白板樣式 (Drawing Board CSS)
   ========================================================= */

.drawing-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(10, 15, 29, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.drawing-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.drawing-modal-container {
    width: 95vw;
    max-width: 1200px;
    height: 90vh;
    max-height: 850px;
    background: var(--ed-panel-bg);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 35px rgba(0, 217, 255, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
}

.drawing-modal-overlay.active .drawing-modal-container {
    transform: scale(1);
}

/* 頂部標頭 */
.drawing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(30, 41, 59, 0.9);
    border-bottom: 1px solid var(--ed-border);
    flex-shrink: 0;
    box-sizing: border-box;
}

.drawing-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.drawing-title i {
    color: var(--cyan, #00d9ff);
}

.drawing-header-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
}

.drawing-header-actions .btn {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    height: 34px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    margin: 0 !important;
    transform: none !important;
}

.drawing-header-actions .btn:hover:not(:disabled) {
    transform: translateY(-1px) !important;
}

.drawing-header-actions .btn:disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* 工具列 (Toolbar) */
.drawing-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 10;
    flex-shrink: 0;
    box-sizing: border-box;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.tool-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(226, 232, 240, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: rgba(0, 217, 255, 0.15);
    color: #ffffff;
    border-color: rgba(0, 217, 255, 0.4);
}

.tool-btn.active {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.3), rgba(0, 119, 255, 0.3));
    color: var(--cyan, #00d9ff);
    border-color: var(--cyan, #00d9ff);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.3);
}

.tool-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* 顏色選擇列 */


/* 筆刷粗細滑桿 */
.brush-size-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 6px;
}

.brush-slider {
    width: 80px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    accent-color: var(--cyan, #00d9ff);
    cursor: pointer;
}

.brush-size-preview {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brush-dot-preview {
    background-color: var(--cyan, #00d9ff);
    border-radius: 50%;
    transition: width 0.15s, height 0.15s;
}

/* 畫布主體區域 */
.drawing-workspace {
    flex: 1;
    position: relative;
    background: #ffffff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
    box-sizing: border-box;
}

/* 畫布底紙模式 */
.drawing-workspace.bg-white {
    background-color: #ffffff !important;
    background-image: none !important;
}

.drawing-workspace.bg-dark {
    background-color: #0f172a !important;
    background-image: none !important;
}

.drawing-workspace.bg-grid {
    background-color: #ffffff !important;
    background-image: linear-gradient(rgba(0, 0, 0, 0.08) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(0, 0, 0, 0.08) 1px, transparent 1px) !important;
    background-size: 20px 20px !important;
}

.drawing-workspace.bg-grid-dark {
    background-color: #0f172a !important;
    background-image: linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) !important;
    background-size: 20px 20px !important;
}

/* 🎨 優雅柔和的透明背景 (微弱低調的灰黑微格，舒適不刺眼) */
.drawing-workspace.bg-transparent {
    background-color: #141e33 !important;
    background-image: 
        linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%), 
        linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.05) 75%), 
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.05) 75%) !important;
    background-size: 24px 24px !important;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0px !important;
}

#drawingCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* 底部操作欄 */
.drawing-footer {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    padding: 12px 24px !important;
    background: rgba(15, 23, 42, 0.95) !important;
    border-top: 1px solid var(--ed-border) !important;
    height: 64px !important;
    min-height: 64px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 20 !important;
}

.drawing-footer-hint {
    font-size: 13px;
    color: rgba(148, 163, 184, 0.9);
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawing-footer-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.drawing-footer-actions .btn {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    height: 38px !important;
    padding: 0 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    transform: none !important;
    transition: all 0.2s ease !important;
}

.drawing-footer-actions .btn:hover {
    transform: translateY(-2px) !important;
}

.drawing-footer-actions .js-btn-save-drawing {
    background: linear-gradient(135deg, var(--cyan, #00d9ff), #0077ff) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(0, 217, 255, 0.3) !important;
}

.drawing-footer-actions .js-btn-save-drawing:hover {
    box-shadow: 0 6px 22px rgba(0, 217, 255, 0.45) !important;
}

/* 筆記內的手繪圖片微光框 */
.note-embedded-drawing {
    display: inline-block;
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(0, 217, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 12px 0;
}

.note-embedded-drawing:hover {
    border-color: var(--cyan, #00d9ff);
    box-shadow: 0 8px 30px rgba(0, 217, 255, 0.35);
    transform: scale(1.01);
}

/* 圖片樣式效果相容 */
.img-shadow-tinymce,
img.img-shadow-tinymce {
    box-shadow: var(--ed-shadow-panel), 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.img-border-tinymce,
img.img-border-tinymce {
    border: 2px solid rgba(255, 255, 255, 0.35) !important;
    box-sizing: border-box;
}

html.light-mode .img-border-tinymce,
html.light-mode img.img-border-tinymce {
    border-color: rgba(0, 0, 0, 0.25) !important;
}

.img-round-tinymce,
img.img-round-tinymce {
    border-radius: 6px !important;
}

.img-circle-tinymce,
img.img-circle-tinymce {
    border-radius: 50% !important;
}

/* =========================================================
   📱 手機版與平板 RWD 適配 (@media max-width: 768px / 480px)
   ========================================================= */
@media (max-width: 768px) {
    .drawing-modal-overlay {
        padding: 0 !important;
    }

    .drawing-modal-container {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
    }

    /* 頂部標頭精簡化 */
    .drawing-header {
        padding: 8px 12px !important;
        height: 48px !important;
        min-height: 48px !important;
    }

    .drawing-title {
        font-size: 13px !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .drawing-header-actions {
        gap: 6px !important;
    }

    .drawing-header-actions .btn {
        height: 30px !important;
        padding: 0 8px !important;
        font-size: 12px !important;
    }

    /* 手機版隱藏按鈕文字，僅保留清晰圖示 */
    .drawing-header-actions .btn span {
        display: none !important;
    }

    .drawing-header-actions .btn i {
        margin: 0 !important;
        font-size: 13px !important;
    }

    /* 工具列：手機端智慧多排緊湊佈局 (一目了然，完全不需費力左右滑動) */
    .drawing-toolbar {
        padding: 6px 10px !important;
        gap: 6px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        background: rgba(15, 23, 42, 0.98) !important;
    }

    /* 第 1 排：繪圖工具橫向自動均分 */
    .drawing-toolbar .tool-group:nth-child(1) {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        padding: 3px 6px !important;
        box-sizing: border-box !important;
        gap: 2px !important;
    }

    .drawing-toolbar .tool-group:nth-child(1) .tool-btn {
        flex: 1 1 0 !important;
        width: auto !important;
        height: 32px !important;
        min-width: 28px !important;
        font-size: 13px !important;
        padding: 0 !important;
    }

    /* 第 2 排與第 3 排：顏色與底紙/筆刷 */
    .drawing-toolbar .tool-group:nth-child(2),
    .drawing-toolbar .tool-group:nth-child(3) {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 3px 6px !important;
        box-sizing: border-box !important;
    }

    .drawing-toolbar .tool-group:nth-child(3) {
        gap: 8px !important;
    }


    .brush-size-wrap {
        flex-shrink: 0 !important;
        padding: 0 2px !important;
    }

    .brush-slider {
        width: 60px !important;
    }

    .js-bg-select {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: none !important;
        font-size: 11px !important;
        height: 28px !important;
        padding: 2px 4px !important;
        text-overflow: ellipsis !important;
        overflow: hidden !important;
    }

    /* 底部操作列 */
    .drawing-footer {
        padding: 8px 12px !important;
        height: 50px !important;
        min-height: 50px !important;
        justify-content: center !important;
    }

    .drawing-footer-hint {
        display: none !important;
    }

    .drawing-footer-actions {
        width: 100% !important;
    }

    .drawing-footer-actions .btn {
        width: 100% !important;
        justify-content: center !important;
        height: 36px !important;
        font-size: 13px !important;
    }
}

/* 確保 SweetAlert2 彈窗高於手繪白板 Modal */
.swal2-container {
    z-index: 200000 !important;
}

/* ⭕ 橡皮擦動態光暈指示圈 (全域通用) */
.sn-eraser-ring {
    position: fixed !important;
    pointer-events: none !important;
    border-radius: 50% !important;
    border: 2px solid var(--ed-accent-strong) !important;
    background: rgba(0, 217, 255, 0.22) !important;
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.6), inset 0 0 8px rgba(0, 217, 255, 0.35) !important;
    transform: translate(-50%, -50%) !important;
    display: none;
    z-index: 2147483647 !important;
    will-change: left, top, width, height;
}

/* 🗑️ 選中圖形底部浮動紅色垃圾桶按鈕 (全域通用) */
.sn-floating-obj-toolbar {
    position: fixed !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2147483647 !important;
    transform: translate(-50%, 0) !important;
    pointer-events: auto !important;
}

.sn-float-del-btn {
    width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(239, 68, 68, 0.9) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45), 0 2px 6px rgba(0, 0, 0, 0.6) !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.sn-float-del-btn:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    transform: scale(1.15) !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.75) !important;
}
