/* =========================================
   1. CSS Variables & Theming
   ========================================= */
:root,
html.dark-mode {
    --bg-color: #222222;
    --text-color: #ffffff;
    --text-muted: #aaaaaa;
    --link-color: #4691ff;
    --code-bg: #1e1e1e;
    --code-header-bg: #2d2d2d;
    --code-text: #cccccc;
    --border-color: #444444;
    --table-border: #555555;
    --table-head-border: #007bff;

    --table-head-bg: rgba(0, 123, 255, 0.15);
    --table-stripe-bg: rgba(255, 255, 255, 0.03);
    --table-hover-outline: rgba(0, 136, 255, 0.25);
    --table-head-text: #ffffff;

    --box-accent-highlight: #ffffff;
    --box-accent-warning: #ffc107;
    --box-accent-info: #0dcaf0;
    --box-accent-success: #28a745;
    --box-accent-error: #dc3545;
    --box-accent-thinking: #2196f3;
    --box-accent-tag: #6f42c1;
    --box-accent-note: #adb5bd;
    --box-bg-highlight: rgba(255, 255, 255, 0.2);
    --box-bg-warning: rgba(255, 193, 7, 0.2);
    --box-bg-info: rgba(13, 202, 240, 0.2);
    --box-bg-success: rgba(40, 167, 69, 0.2);
    --box-bg-error: rgba(220, 53, 69, 0.2);
    --box-bg-thinking: rgba(33, 150, 243, 0.2);
    --box-bg-tag: rgba(111, 66, 193, 0.2);
    --box-bg-note: rgba(128, 128, 128, 0.2);
    --hover-bg: rgba(255, 255, 255, 0.1);
}

html.light-mode {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --text-muted: #666666;
    --link-color: #007bff;
    --code-bg: #f5f5f5;
    --code-header-bg: #e9ecef;
    --code-text: #333333;
    --border-color: #dddddd;
    --table-border: #cccccc;
    --table-head-border: #0056b3;

    --table-head-bg: rgba(0, 123, 255, 0.08);
    --table-stripe-bg: rgba(0, 0, 0, 0.025);
    --table-hover-outline: rgba(0, 123, 255, 0.2);
    --table-head-text: #1a1a2e;

    --box-accent-highlight: #333333;
    --box-accent-info: #0077aa;
    --box-accent-thinking: #0056d6;
    --box-accent-tag: #5a2d9e;
    --box-bg-highlight: rgba(0, 0, 0, 0.05);
    --box-bg-warning: rgba(255, 193, 7, 0.15);
    --box-bg-info: rgba(0, 119, 170, 0.1);
    --box-bg-success: rgba(40, 167, 69, 0.1);
    --box-bg-error: rgba(220, 53, 69, 0.1);
    --box-bg-thinking: rgba(0, 86, 214, 0.1);
    --box-bg-tag: rgba(90, 45, 158, 0.1);
    --box-bg-note: rgba(128, 128, 128, 0.1);
    --hover-bg: rgba(0, 0, 0, 0.05);
}

/* =========================================
   2. Base Styles
   ========================================= */
.tox-tinymce {
    height: 100% !important;
    min-height: 500px;
    position: relative;
    border: none !important;
    border-radius: 0 !important;
}

body.tinymce-scope {
    background-color: var(--bg-color);
    color: var(--text-color) !important;
    overflow-y: auto !important;
    transition: background-color 0.25s ease, color 0.25s ease;
    -webkit-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
    cursor: text !important;
}

.tinymce-scope {
    padding: 25px;
    counter-reset: circle-counter alpha-counter roman-counter btn-num-counter bulb-counter tgt-counter;
}

.tinymce-scope h1,
.tinymce-scope h2,
.tinymce-scope h3,
.tinymce-scope h4,
.tinymce-scope h5,
.tinymce-scope h6 {
    color: var(--text-color);
    font-weight: 700;
    line-height: 1.2;
    display: block;
    margin: 0.8em 0;
    margin-top: 2em;
    width: auto;
    word-break: break-word;
}

.tinymce-scope h1 {
    font-size: 2.25rem;
    margin-top: 1em;
}

.tinymce-scope h2 {
    font-size: 1.875rem;
}

.tinymce-scope h3 {
    font-size: 1.5rem;
}

.tinymce-scope h4 {
    font-size: 1.25rem;
}

.tinymce-scope h5 {
    font-size: 1.125rem;
}

.tinymce-scope h6 {
    font-size: 1rem;
}

.tinymce-scope div,
.tinymce-scope p {
    color: var(--text-color);
    font-size: 1rem !important;
    text-align: justify;
    word-break: break-word;
    line-height: 1.8;
}

.tinymce-scope p {
    margin-top: 0;
    margin-bottom: 12px;
}

.tinymce-scope strong {
    color: var(--box-accent-info);
    font-weight: 700;
}

.tinymce-scope a {
    color: var(--link-color);
    text-decoration: none;
}

.tinymce-scope a:hover {
    text-decoration: underline;
}

.tinymce-scope ul,
.tinymce-scope ol {
    padding-left: 2em;
    margin-bottom: 1rem;
}

.tinymce-scope li {
    margin-bottom: 0.5em;
    font-size: 1rem !important;
}

.tinymce-scope blockquote {
    border-left: 4px solid var(--border-color);
    margin: 1.5em 0;
    padding: 0.5em 1em;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(128, 128, 128, 0.05);
}

/* =========================================
   3. Tables 
   ========================================= */
.tinymce-scope table {
    width: 100%;
    margin-bottom: 1.5rem;
    border-collapse: separate !important;
    border-spacing: 0;
    border: 1px solid var(--table-border) !important;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.tinymce-scope table td,
.tinymce-scope table th {
    padding: 0.7rem 1rem;
    border-top: none !important;
    border-left: none !important;
    border-right: 1px solid var(--table-border) !important;
    border-bottom: 1px solid var(--table-border) !important;
    vertical-align: middle;
    line-height: 1.5;
    min-width: 60px;
    font-size: 1rem;
}

.tinymce-scope table td p,
.tinymce-scope table th p {
    margin: 0;
}

.tinymce-scope table tr th:last-child,
.tinymce-scope table tr td:last-child {
    border-right: none !important;
}

.tinymce-scope table tbody tr:last-child th,
.tinymce-scope table tbody tr:last-child td,
.tinymce-scope table tr:last-child td {
    border-bottom: none !important;
}

.tinymce-scope table thead th:not([style*="background"]) {
    background: var(--table-head-bg);
}

.tinymce-scope table thead th {
    border-bottom: 2px solid var(--table-head-border) !important;
    font-weight: 700;
    text-align: center;
    color: var(--table-head-text);
    letter-spacing: 0.03em;
    font-size: 0.92em;
    padding: 0.75rem 1rem;
}

.tinymce-scope table tbody tr:nth-child(odd) td:not([style*="background"]) {
    background: var(--table-stripe-bg);
}

.tinymce-scope table tbody tr:hover td {
    background-color: var(--hover-bg);
    cursor: default;
}

.tinymce-scope table td.mce-item-selected,
.tinymce-scope table th.mce-item-selected {
    outline: 2px solid rgba(0, 136, 255, 0.8);
    outline-offset: -2px;
}

.tinymce-scope table caption {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    caption-side: bottom;
    font-size: 0.85em;
    font-style: italic;
}

.tinymce-scope .mce-table-resize-bar {
    background: rgba(0, 136, 255, 0.6);
    width: 3px;
}

.tinymce-scope .table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.tinymce-scope .table-responsive-wrapper table {
    margin-bottom: 0;
}

/* =========================================
   3-1. Code Blocks
   ========================================= */
.tinymce-scope pre[class*=language-] {
    position: relative;
    background: var(--code-bg) !important;
    color: var(--code-text);
    font-family: Consolas, Monaco, monospace;
    font-size: 15px;
    line-height: 1.5;
    padding: 20px;
    overflow: hidden;
    overflow-x: auto;
    margin: 0;
    border: 1px solid var(--border-color);
}

.tinymce-scope :not(pre)>code {
    background-color: var(--hover-bg);
    color: var(--box-accent-thinking);
    padding: 0.2em 0.4em;
    border-radius: 4px;
}

.tinymce-scope .code-container {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.tinymce-scope .code-header {
    height: 40px;
    background: var(--code-header-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    font-family: monospace;
    font-size: 13px;
    color: #ccc;
}

.tinymce-scope .copy-button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
}

.tinymce-scope .copy-button:hover {
    background: var(--hover-bg);
}

/* =========================================
   4. Images Custom Styles
   ========================================= */
.tinymce-scope img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* 攔截 TinyMCE 原生的浮動對齊，改為 Margin 對齊以避免跑版 */
.tinymce-scope img[style*="float: left"],
.tinymce-scope img[style*="float:left"] {
    float: none !important;
    display: block !important;
    margin-left: 0 !important;
    margin-right: auto !important;
}

.tinymce-scope img[style*="float: right"],
.tinymce-scope img[style*="float:right"] {
    float: none !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

.tinymce-scope figure {
    margin: 0;
}

.tinymce-scope figcaption {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 0.5em;
}

.tinymce-scope img.img-shadow-tinymce {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.tinymce-scope img.img-border-tinymce {
    border: 3px solid var(--border-color) !important;
    padding: 4px !important;
}

.tinymce-scope img.img-round-tinymce {
    border-radius: 8px !important;
}

.tinymce-scope img.img-circle-tinymce {
    border-radius: 50% !important;
    aspect-ratio: 1/1;
    object-fit: cover;
}


/* =========================================
   5. Boxes (Components)
   ========================================= */
[class$="-box-tinymce"],
[class$="-block-tinymce"] {
    padding: 1.25em;
    margin: 1.5em 0;
    border-radius: 6px;
    position: relative;
    color: var(--text-color);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
    background: transparent;
    transition: all 0.2s ease;
    min-height: 1.5em; /* 確保即使內容被完全清空，也能有基本高度可供點擊 */
}

.highlight-box-tinymce {
    border-left: 5px solid var(--box-accent-highlight);
    background-color: var(--box-bg-highlight);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.07);
}

.warning-box-tinymce {
    border-left: 8px double var(--box-accent-warning);
    background-color: var(--box-bg-warning);
}

.info-box-tinymce {
    border-left: 5px solid var(--box-accent-info);
    background-color: var(--box-bg-info);
    border-top-right-radius: 20px;
}

.success-box-tinymce {
    border: 1px solid rgba(40, 167, 69, 0.25);
    border-left: 6px solid var(--box-accent-success);
    background-color: var(--box-bg-success);
}

.error-box-tinymce {
    border-left: 5px solid var(--box-accent-error);
    background-image: linear-gradient(to right, rgba(220, 53, 69, 0.12), rgba(220, 53, 69, 0.03));
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.05);
}

.thinking-box-tinymce {
    border-left: 5px dashed var(--box-accent-thinking);
    background-color: var(--box-bg-thinking);
    font-style: italic;
}

.tag-box-tinymce {
    border-left: 5px solid var(--box-accent-tag);
    background-color: var(--box-bg-tag);
}

.note-box-tinymce {
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--box-accent-note);
    background-color: var(--box-bg-note);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.hot-box-tinymce {
    border-left: 5px solid #ff5722;
    background: linear-gradient(to right, rgba(255, 87, 34, 0.1), transparent);
}

.award-box-tinymce {
    border: 2px solid var(--box-accent-warning);
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.2);
    border-radius: 8px;
    background: linear-gradient(135deg, var(--box-bg-warning) 0%, transparent 100%);
    position: relative;
}

.award-box-tinymce::before {
    content: "🏆";
    position: absolute;
    top: -12px;
    right: -10px;
    font-size: 1.5em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.data-box-tinymce {
    background: var(--code-bg);
    border-left: 5px solid var(--box-accent-success);
    font-family: Consolas, Monaco, monospace;
    color: var(--box-accent-success);
}

.step-box-tinymce {
    border-left: 6px dotted var(--box-accent-info);
    background-color: var(--box-bg-info);
}

.story-box-tinymce {
    font-family: Georgia, serif;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    padding: 1.5em 1em;
    background: rgba(128, 128, 128, 0.05);
    border-radius: 0;
}

.dialogue-box-tinymce {
    background: var(--hover-bg);
    border-radius: 16px;
    border-bottom-left-radius: 0;
    padding: 1em 1.5em;
    display: inline-block;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.05);
}

.summary-box-tinymce {
    border-top: 4px solid var(--box-accent-thinking);
    background: var(--box-bg-thinking);
    border-radius: 0 0 6px 6px;
    font-weight: 500;
}

.caution-box-tinymce {
    border: 2px solid var(--box-accent-error);
    background: repeating-linear-gradient(45deg, var(--box-bg-error), var(--box-bg-error) 10px, transparent 10px, transparent 20px);
    border-radius: 4px;
}

.parchment-box-tinymce {
    background: rgba(245, 222, 179, 0.1);
    color: var(--text-color);
    border: 4px double var(--box-accent-warning);
    font-family: Georgia, serif;
    border-radius: 2px;
    padding: 1.5em;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

/* 📦 區塊樣式 (加入綠、紅、棕，移除深灰、紫色) */
.text-box-tinymce {
    background: var(--hover-bg);
    border: 2px dashed var(--border-color);
}

.border-box-tinymce {
    background: transparent;
    border: 2px dashed var(--border-color);
}

.custom-box-tinymce {
    border: 2px dashed var(--text-muted);
    border-left: 2px dashed var(--text-muted);
    background-color: var(--box-bg-note);
}

.question-box-tinymce {
    background-color: rgba(0, 123, 255, 0.1);
    border: 2px dashed #007bff;
}

.answer-box-tinymce {
    background-color: rgba(23, 162, 184, 0.1);
    border: 2px dashed #17a2b8;
}

.todo-box-tinymce {
    background-color: rgba(173, 181, 189, 0.1);
    border: 2px dashed #adb5bd;
    border-radius: 12px;
}

.reminder-box-tinymce {
    background-color: rgba(255, 193, 7, 0.1);
    border: 2px dashed #ffc107;
    border-radius: 12px;
}

.tag-block-tinymce {
    border: 2px dashed var(--box-accent-tag);
    background-color: var(--box-bg-tag);
    border-radius: 8px;
}

.cyan-block-tinymce {
    background-color: rgba(13, 202, 240, 0.08);
    border: 2px dashed #0dcaf0;
    border-radius: 8px;
}

.pink-block-tinymce {
    background-color: rgba(232, 62, 140, 0.08);
    border: 2px dashed #e83e8c;
    border-radius: 8px;
}

.orange-block-tinymce {
    background-color: rgba(253, 126, 20, 0.08);
    border: 2px dashed #fd7e14;
    border-radius: 8px;
}

.green-block-tinymce {
    background-color: rgba(40, 167, 69, 0.08);
    border: 2px dashed #28a745;
    border-radius: 8px;
}

.red-block-tinymce {
    background-color: rgba(220, 53, 69, 0.08);
    border: 2px dashed #dc3545;
    border-radius: 8px;
}

.brown-block-tinymce {
    background-color: rgba(139, 69, 19, 0.08);
    border: 2px dashed #8b4513;
    border-radius: 8px;
}

/* 特色匡線樣式 */
.pros-box-tinymce {
    border-top: 4px solid var(--box-accent-success);
    background-color: rgba(40, 167, 69, 0.05);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.cons-box-tinymce {
    border-top: 4px solid var(--box-accent-error);
    background-color: rgba(220, 53, 69, 0.05);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.done-box-tinymce {
    border: 2px solid var(--box-accent-success);
    background: repeating-linear-gradient(135deg, rgba(40, 167, 69, 0.05) 0px, rgba(40, 167, 69, 0.05) 10px, transparent 10px, transparent 20px);
    border-radius: 8px;
}

.alert-box-tinymce {
    border: 3px solid var(--box-accent-error);
    border-top: 12px solid var(--box-accent-error);
    background-color: var(--box-bg-error);
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}


/* =========================================
   6. Lists
   ========================================= */
.tinymce-scope ul.check-list,
.tinymce-scope ul.star-list,
.tinymce-scope ul.button-list,
.tinymce-scope ul.circle-list,
.tinymce-scope ul.red-circle-list,
.tinymce-scope ul.triangle-list,
.tinymce-scope ul.lightning-list,
.tinymce-scope ul.exclamation-list,
.tinymce-scope ul.fire-list,
.tinymce-scope ul.target-list,
.tinymce-scope ul.action-list,
.tinymce-scope ul.question-list,
.tinymce-scope ul.key-list,
.tinymce-scope ul.idea-list {
    list-style: none;
}

/* 讓所有客製化圖示清單具備凸排（Hanging Indent）效果 */
.tinymce-scope ul.check-list li,
.tinymce-scope ul.star-list li,
.tinymce-scope ul.button-list li,
.tinymce-scope ul.circle-list li,
.tinymce-scope ul.red-circle-list li,
.tinymce-scope ul.triangle-list li,
.tinymce-scope ul.lightning-list li,
.tinymce-scope ul.exclamation-list li,
.tinymce-scope ul.fire-list li,
.tinymce-scope ul.target-list li,
.tinymce-scope ul.action-list li,
.tinymce-scope ul.question-list li,
.tinymce-scope ul.key-list li,
.tinymce-scope ul.idea-list li,
.tinymce-scope ul.custom-attr-list-tinymce li {
    padding-left: 1.8em;
    text-indent: -1.8em;
}

.tinymce-scope ul.check-list li::before {
    content: "✅ ";
    margin-right: 0.5em;
}

.tinymce-scope ul.star-list li::before {
    content: "⭐ ";
    margin-right: 0.5em;
}

.tinymce-scope ul.button-list li::before {
    content: "📌 ";
    margin-right: 0.5em;
}

.tinymce-scope ul.circle-list li::before {
    content: "🔵 ";
    margin-right: 0.5em;
}

.tinymce-scope ul.red-circle-list li::before {
    content: "🔴 ";
    margin-right: 0.5em;
}

.tinymce-scope ul.triangle-list li::before {
    content: "📐 ";
    margin-right: 0.5em;
}

.tinymce-scope ul.lightning-list li::before {
    content: "⚡ ";
    margin-right: 0.5em;
}

.tinymce-scope ul.idea-list li::before {
    content: "💡 ";
    margin-right: 0.5em;
}

.tinymce-scope ul.exclamation-list li::before {
    content: "❗ ";
    margin-right: 0.5em;
}

.tinymce-scope ul.fire-list li::before {
    content: "🔥 ";
    margin-right: 0.5em;
}

.tinymce-scope ul.target-list li::before {
    content: "🎯 ";
    margin-right: 0.5em;
}

.tinymce-scope ul.action-list li::before {
    content: "🚀 ";
    margin-right: 0.5em;
}

.tinymce-scope ul.question-list li::before {
    content: "❓ ";
    margin-right: 0.5em;
}

.tinymce-scope ul.key-list li::before {
    content: "🔑 ";
    margin-right: 0.5em;
}

/* 自訂圖案清單 (利用 CSS 變數繼承使用者輸入的圖示) */
.tinymce-scope ul.custom-attr-list-tinymce {
    list-style: none !important;
}
.tinymce-scope ul.custom-attr-list-tinymce li::before {
    content: var(--custom-list-icon, "👉 ");
    margin-right: 0.5em;
}

/* =========================================
   純文字編號樣式 (使用原生 list-style，無設計套用時)
   ========================================= */
.tinymce-scope ol.list-type-decimal:not([class*="-num-list-tinymce"]):not([class*="-badge-list-tinymce"]):not([class*="-list-tinymce"]) {
    list-style-type: decimal !important;
    padding-left: 2rem !important;
}
.tinymce-scope ol.list-type-lower-alpha:not([class*="-num-list-tinymce"]):not([class*="-badge-list-tinymce"]):not([class*="-list-tinymce"]) {
    list-style-type: lower-alpha !important;
    padding-left: 2rem !important;
}
.tinymce-scope ol.list-type-upper-alpha:not([class*="-num-list-tinymce"]):not([class*="-badge-list-tinymce"]):not([class*="-list-tinymce"]) {
    list-style-type: upper-alpha !important;
    padding-left: 2rem !important;
}
.tinymce-scope ol.list-type-lower-roman:not([class*="-num-list-tinymce"]):not([class*="-badge-list-tinymce"]):not([class*="-list-tinymce"]) {
    list-style-type: lower-roman !important;
    padding-left: 2rem !important;
}

/* 確保只要有套用設計樣式的，一定會隱藏原生項目符號 */
.tinymce-scope ol[class*="-list-tinymce"] {
    list-style: none !important;
    padding-left: 1.5rem !important;
}

.tinymce-scope ol[class*="-list-tinymce"]>li {
    position: relative;
    padding-left: 2rem !important;
    margin-bottom: 0.75rem;
}

.tinymce-scope ol.circle-num-list-tinymce>li::before {
    counter-increment: circle-counter;
    content: counter(circle-counter);
    position: absolute;
    left: 0;
    top: 4px;
    width: 20px;
    height: 20px;
    background-color: var(--box-accent-thinking);
    color: #fff;
    border-radius: 50%;
    font-size: 0.8em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tinymce-scope ol.alpha-badge-list-tinymce>li::before {
    counter-increment: alpha-counter;
    content: counter(alpha-counter, upper-alpha);
    position: absolute;
    left: 0;
    top: 4px;
    padding: 1px 6px;
    background-color: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 強調底線 */
.tinymce-scope ol.underline-num-list-tinymce>li::before {
    counter-increment: underline-counter;
    content: counter(underline-counter) ".";
    position: absolute;
    left: 0;
    top: 2px;
    font-weight: bold;
    color: var(--box-accent-info, #3b82f6);
    border-bottom: 2px solid var(--box-accent-info, #3b82f6);
    padding-bottom: 2px;
    line-height: 1;
}

/* 括號編號 */
.tinymce-scope ol.bracket-num-list-tinymce>li::before {
    counter-increment: bracket-counter;
    content: "【" counter(bracket-counter) "】";
    position: absolute;
    left: -0.5rem;
    top: 2px;
    font-weight: bold;
    color: var(--text-color);
    opacity: 0.8;
}

.tinymce-scope ol.gray-badge-num-list-tinymce>li::before {
    counter-increment: btn-num-counter;
    content: counter(btn-num-counter);
    position: absolute;
    left: 0;
    top: 4px;
    width: 20px;
    height: 20px;
    background-color: var(--code-header-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   解耦：型態覆寫規則 (當設計與型態組合時)
   ========================================= */
/* 藍圈圈 */
.tinymce-scope ol.circle-num-list-tinymce.list-type-decimal>li::before { content: counter(circle-counter, decimal) !important; }
.tinymce-scope ol.circle-num-list-tinymce.list-type-lower-alpha>li::before { content: counter(circle-counter, lower-alpha) !important; }
.tinymce-scope ol.circle-num-list-tinymce.list-type-upper-alpha>li::before { content: counter(circle-counter, upper-alpha) !important; }
.tinymce-scope ol.circle-num-list-tinymce.list-type-lower-roman>li::before { content: counter(circle-counter, lower-roman) !important; }

/* 灰膠囊 */
.tinymce-scope ol.gray-badge-num-list-tinymce.list-type-decimal>li::before { content: counter(btn-num-counter, decimal) !important; }
.tinymce-scope ol.gray-badge-num-list-tinymce.list-type-lower-alpha>li::before { content: counter(btn-num-counter, lower-alpha) !important; }
.tinymce-scope ol.gray-badge-num-list-tinymce.list-type-upper-alpha>li::before { content: counter(btn-num-counter, upper-alpha) !important; }
.tinymce-scope ol.gray-badge-num-list-tinymce.list-type-lower-roman>li::before { content: counter(btn-num-counter, lower-roman) !important; }

/* 字母徽章 */
.tinymce-scope ol.alpha-badge-list-tinymce.list-type-decimal>li::before { content: counter(alpha-counter, decimal) !important; }
.tinymce-scope ol.alpha-badge-list-tinymce.list-type-lower-alpha>li::before { content: counter(alpha-counter, lower-alpha) !important; }
.tinymce-scope ol.alpha-badge-list-tinymce.list-type-upper-alpha>li::before { content: counter(alpha-counter, upper-alpha) !important; }
.tinymce-scope ol.alpha-badge-list-tinymce.list-type-lower-roman>li::before { content: counter(alpha-counter, lower-roman) !important; }

/* 強調底線 */
.tinymce-scope ol.underline-num-list-tinymce.list-type-decimal>li::before { content: counter(underline-counter, decimal) "." !important; }
.tinymce-scope ol.underline-num-list-tinymce.list-type-lower-alpha>li::before { content: counter(underline-counter, lower-alpha) "." !important; }
.tinymce-scope ol.underline-num-list-tinymce.list-type-upper-alpha>li::before { content: counter(underline-counter, upper-alpha) "." !important; }
.tinymce-scope ol.underline-num-list-tinymce.list-type-lower-roman>li::before { content: counter(underline-counter, lower-roman) "." !important; }

/* 括號編號 */
.tinymce-scope ol.bracket-num-list-tinymce.list-type-decimal>li::before { content: "【" counter(bracket-counter, decimal) "】" !important; }
.tinymce-scope ol.bracket-num-list-tinymce.list-type-lower-alpha>li::before { content: "【" counter(bracket-counter, lower-alpha) "】" !important; }
.tinymce-scope ol.bracket-num-list-tinymce.list-type-upper-alpha>li::before { content: "【" counter(bracket-counter, upper-alpha) "】" !important; }
.tinymce-scope ol.bracket-num-list-tinymce.list-type-lower-roman>li::before { content: "【" counter(bracket-counter, lower-roman) "】" !important; }




.tinymce-scope ol.restart-counter-tinymce.circle-num-list-tinymce {
    counter-reset: circle-counter;
}

.tinymce-scope ol.restart-counter-tinymce.alpha-badge-list-tinymce {
    counter-reset: alpha-counter;
}

.tinymce-scope ol.restart-counter-tinymce.underline-num-list-tinymce {
    counter-reset: underline-counter;
}

.tinymce-scope ol.restart-counter-tinymce.bracket-num-list-tinymce {
    counter-reset: bracket-counter;
}

.tinymce-scope ol.restart-counter-tinymce.target-num-list-tinymce {
    counter-reset: tgt-counter;
}



.tinymce-scope ol.continue-counter-tinymce,
.tinymce-scope ol.continue-counter-tinymce.restart-counter-tinymce {
    counter-reset: none !important;
}

/* =========================================
   7. Layouts & New Boxes
   ========================================= */
.tinymce-scope .row-layout-2cols-tinymce,
.tinymce-scope .row-layout-3cols-tinymce {
    display: flex;
    gap: 1.25rem;
    margin: 1.5rem 0;
    width: 100%;
}

.tinymce-scope .col-layout-tinymce {
    flex: 1;
    min-width: 0;
    padding: 1rem;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.01);
}

@media screen and (max-width: 768px) {

    .tinymce-scope .row-layout-2cols-tinymce,
    .tinymce-scope .row-layout-3cols-tinymce {
        flex-direction: column;
        gap: 1rem;
    }

    body.tinymce-scope {
        padding: 1rem !important;
        font-size: 15px;
    }

    .tinymce-scope table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media screen and (max-width: 480px) {
    body.tinymce-scope {
        padding: 0.75rem !important;
    }

    [class$="-box-tinymce"] {
        padding: 0.75em;
        margin: 0.75em 0;
        border-left-width: 4px;
    }
}

.tinymce-scope .card-grid-tinymce {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.tinymce-scope .card-item-tinymce {
    padding: 1.25rem;
    border-radius: 8px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tinymce-scope .timeline-container-tinymce {
    position: relative;
    border-left: 2px solid var(--border-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0 1.5rem 1rem;
}

.tinymce-scope .timeline-item-tinymce {
    position: relative;
    margin-bottom: 1.5rem;
}

.tinymce-scope .timeline-item-tinymce::before {
    content: "";
    position: absolute;
    left: calc(-1.5rem - 6px - 1px);
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 3px solid var(--box-accent-thinking);
}

.code-box-tinymce {
    font-family: Consolas, Monaco, monospace;
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--box-accent-thinking);
    border-radius: 4px;
    padding: 1.25em;
}

.meeting-box-tinymce {
    border-top: 3px double var(--box-accent-success);
    border-bottom: 3px double var(--box-accent-success);
    background-color: rgba(40, 167, 69, 0.03);
    border-radius: 0;
    padding: 1.25em 0.5em;
}

.quote-box-tinymce {
    background-color: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.4);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.1);
    border-radius: 6px;
    font-style: italic;
    padding: 1.5em 2.5em;
    position: relative;
}

.quote-box-tinymce::before {
    content: "“";
    position: absolute;
    left: 8px;
    top: -5px;
    font-size: 3em;
    color: var(--box-accent-warning);
    font-family: Georgia, serif;
    opacity: 0.5;
}

.quote-box-tinymce::after {
    content: "”";
    position: absolute;
    right: 8px;
    bottom: -25px;
    font-size: 3em;
    color: var(--box-accent-warning);
    font-family: Georgia, serif;
    opacity: 0.5;
}

.target-box-tinymce {
    border: 1px dashed rgba(13, 202, 240, 0.4);
    border-left: 6px solid var(--box-accent-info);
    background-image: linear-gradient(135deg, rgba(13, 202, 240, 0.08) 0%, rgba(33, 150, 243, 0.02) 100%);
    border-radius: 8px;
    padding: 1.2em 1.5em;
}

.secret-box-tinymce {
    border: 1px dashed var(--box-accent-tag);
    background: repeating-linear-gradient(45deg, rgba(111, 66, 193, 0.03), rgba(111, 66, 193, 0.03) 10px, rgba(111, 66, 193, 0.06) 10px, rgba(111, 66, 193, 0.06) 20px);
    border-radius: 6px;
    padding: 1.2em 1.5em;
}

.sticky-note-tinymce {
    background-color: rgba(255, 235, 59, 0.07);
    border-left: 5px solid var(--box-accent-warning);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 2px 5px 12px rgba(0, 0, 0, 0.08);
    transform: rotate(-0.5deg);
    padding: 1.2em 1.5em;
}

.tinymce-scope mark.marker-half-yellow-tinymce {
    background: linear-gradient(to top, rgba(255, 235, 59, 0.6) 40%, transparent 40%);
    color: inherit;
    padding: 0 2px;
}

.tinymce-scope mark.marker-yellow-tinymce {
    background-color: rgba(255, 235, 59, 0.35);
    color: inherit;
    border-radius: 2px;
    padding: 0 4px;
}

.tinymce-scope mark.marker-green-tinymce {
    background-color: rgba(76, 175, 80, 0.3);
    color: inherit;
    border-radius: 2px;
    padding: 0 4px;
}

.tinymce-scope mark.marker-blue-tinymce {
    background-color: rgba(33, 150, 243, 0.25);
    color: inherit;
    border-radius: 2px;
    padding: 0 4px;
}

.tinymce-scope mark.marker-red-tinymce {
    background-color: rgba(244, 67, 54, 0.25);
    color: inherit;
    border-radius: 2px;
    padding: 0 4px;
}

.tinymce-scope mark.marker-purple-tinymce {
    background-color: rgba(156, 39, 176, 0.25);
    color: inherit;
    border-radius: 2px;
    padding: 0 4px;
}

.tinymce-scope mark.marker-orange-tinymce {
    background-color: rgba(255, 152, 0, 0.3);
    color: inherit;
    border-radius: 2px;
    padding: 0 4px;
}

.tinymce-scope kbd.kbd-tinymce {
    background-color: var(--code-header-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    padding: 2px 5px;
    font-size: 0.85em;
    border-radius: 4px;
    font-family: inherit;
}

.tinymce-scope code.inline-code-tinymce {
    background-color: rgba(128, 128, 128, 0.15);
    color: var(--box-accent-warning);
    padding: 2px 6px;
    font-size: 0.9em;
    border-radius: 4px;
    font-family: var(--font-family, monospace);
}

.tinymce-scope .wavy-underline-tinymce {
    text-decoration: underline wavy var(--box-accent-error);
}

.tinymce-scope .dashed-underline-tinymce {
    text-decoration: underline dashed var(--text-muted);
    text-underline-offset: 4px;
}

/* 特殊文字樣式 */
.tinymce-scope .spoiler-text-tinymce {
    background-color: var(--text-color);
    color: transparent;
    border-radius: 4px;
    padding: 0 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.tinymce-scope .spoiler-text-tinymce:hover {
    background-color: rgba(128, 128, 128, 0.1);
    color: var(--text-color);
}

.tinymce-scope .rainbow-text-tinymce {
    background-image: linear-gradient(to right, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff);
    -webkit-background-clip: text;
    color: transparent;
    font-weight: bold;
}

.tinymce-scope .badge-tinymce {
    padding: 2px 8px;
    border-radius: 12px;
    background-color: var(--hover-bg);
    border: 1px solid var(--border-color);
    font-size: 0.85em;
    font-weight: bold;
    white-space: nowrap;
}

.tinymce-scope .neon-text-tinymce {
    color: #fff;
    text-shadow: 0 0 5px var(--box-accent-info), 0 0 10px var(--box-accent-info), 0 0 20px var(--box-accent-info);
    background-color: #1a1a1a;
    padding: 2px 6px;
    border-radius: 4px;
}

.tinymce-scope .engraved-text-tinymce {
    color: var(--bg-color);
    text-shadow: 1px 1px 1px var(--text-muted), -1px -1px 1px rgba(0, 0, 0, 0.5);
    font-weight: bold;
    background-color: var(--text-color);
    padding: 2px 4px;
    border-radius: 2px;
}

.tinymce-scope .btn-3d-tinymce {
    display: inline-block;
    padding: 2px 8px;
    background: var(--code-header-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 3px 0 var(--border-color);
    font-weight: bold;
    transform: translateY(-2px);
    margin: 0 2px;
}

.tinymce-scope .zoom-text-tinymce {
    font-size: 1.25em;
    font-weight: 900;
    color: var(--box-accent-error);
    letter-spacing: 1px;
    display: inline-block;
    transform: scale(1.05);
}

span[data-icon]::before {
    content: attr(data-icon) " ";
    margin-right: 0.5em;
}

/* 修復標籤無法刪除的問題：如果標籤內沒有任何文字（或只剩佔位符），自動隱藏它 */
.tinymce-scope span[data-icon]:empty,
.tinymce-scope span[data-icon]:has(> br),
.tinymce-scope span[data-icon]:has(> br[data-mce-bogus]),
span[data-icon]:empty::before,
span[data-icon]:has(> br)::before,
span[data-icon]:has(> br[data-mce-bogus])::before {
    display: none !important;
    content: "" !important;
}

/* 自訂文字樣式 (動態套用顏色) */
.tinymce-scope span.custom-inline-tinymce {
    border-radius: 4px;
    font-weight: 500;
}

/* 標籤文字段落：清單式懸掛縮排 (Hanging Indent) 效果，動態自適應標籤長度 (支援自訂任意字數標籤) */
.tinymce-scope p:has(> span[data-icon]:first-child),
.tinymce-scope p:has(> span.custom-inline-tinymce:first-child),
.tinymce-scope h1:has(> span[data-icon]:first-child),
.tinymce-scope h2:has(> span[data-icon]:first-child),
.tinymce-scope h3:has(> span[data-icon]:first-child),
.tinymce-scope h4:has(> span[data-icon]:first-child),
.tinymce-scope h5:has(> span[data-icon]:first-child),
.tinymce-scope h6:has(> span[data-icon]:first-child),
.tinymce-scope li:has(> span[data-icon]:first-child) {
    padding-left: var(--tag-indent, 1.8em);
    text-indent: calc(-1 * var(--tag-indent, 1.8em));
}


/* ==========================================================================
          🎨 TinyMCE 下拉選單所見即所得樣式預覽
   ========================================================================== */
.tox-menu .tox-collection__item {
    padding: 1px 4px !important;
}

.tox-menu .tox-collection__item-label {
    display: block !important;
    padding: 3px 8px !important;
    font-size: 0.85em !important;
    box-sizing: border-box !important;
    line-height: 1.25 !important;
}

.tox-menu .tox-collection__item--active {
    background-color: rgba(128, 128, 128, 0.1) !important;
    color: inherit !important;
}

/* 共用提取區塊 */
.tox-collection__item[aria-label*="框"] .tox-collection__item-label,
.tox-collection__item[aria-label*="區"] .tox-collection__item-label {
    color: var(--text-color) !important;
    border-radius: 6px !important;
}

.tox-collection__item[aria-label*="螢光筆"] .tox-collection__item-label {
    color: inherit !important;
    display: inline-block !important;
    width: auto !important;
    border-radius: 2px !important;
    padding: 2px 6px !important;
}

.tox-collection__item[aria-label="💡 提示框"] .tox-collection__item-label {
    background-color: var(--box-bg-highlight) !important;
    border-left: 5px solid var(--box-accent-highlight) !important;
}

.tox-collection__item[aria-label="⚠️ 警告框"] .tox-collection__item-label {
    background-color: var(--box-bg-warning) !important;
    border-left: 8px double var(--box-accent-warning) !important;
}

.tox-collection__item[aria-label="📘 資訊框"] .tox-collection__item-label {
    background-color: var(--box-bg-info) !important;
    border-left: 5px solid var(--box-accent-info) !important;
    border-top-right-radius: 20px !important;
}

.tox-collection__item[aria-label="✅ 成功框"] .tox-collection__item-label {
    background-color: var(--box-bg-success) !important;
    border: 1px solid rgba(40, 167, 69, 0.25) !important;
    border-left: 6px solid var(--box-accent-success) !important;
}

.tox-collection__item[aria-label="❌ 錯誤框"] .tox-collection__item-label {
    border-left: 5px solid var(--box-accent-error) !important;
    background-image: linear-gradient(to right, rgba(220, 53, 69, 0.12), rgba(220, 53, 69, 0.03)) !important;
}

.tox-collection__item[aria-label="🧠 思考框"] .tox-collection__item-label {
    background-color: var(--box-bg-thinking) !important;
    border-left: 5px dashed var(--box-accent-thinking) !important;
    font-style: italic !important;
}

.tox-collection__item[aria-label="📎 附註框"] .tox-collection__item-label {
    background-color: var(--box-bg-tag) !important;
    border-left: 5px solid var(--box-accent-tag) !important;
}

.tox-collection__item[aria-label="📝 筆記框"] .tox-collection__item-label {
    border: 1px solid var(--border-color) !important;
    border-left: 4px solid var(--box-accent-note) !important;
    background-color: var(--box-bg-note) !important;
}

.tox-collection__item[aria-label="🔥 焦點框"] .tox-collection__item-label {
    border-left: 5px solid #ff5722 !important;
    background: linear-gradient(to right, rgba(255, 87, 34, 0.1), transparent) !important;
}

.tox-collection__item[aria-label="📊 數據框"] .tox-collection__item-label {
    background: var(--code-bg) !important;
    border-left: 5px solid var(--box-accent-success) !important;
    font-family: monospace !important;
    color: var(--box-accent-success) !important;
}

.tox-collection__item[aria-label="🏆 冠軍獎點框"] .tox-collection__item-label {
    border: 2px solid var(--box-accent-warning) !important;
    background: linear-gradient(135deg, var(--box-bg-warning) 0%, transparent 100%) !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🐾 步驟教學框"] .tox-collection__item-label {
    background-color: var(--box-bg-info) !important;
    border-left: 6px dotted var(--box-accent-info) !important;
}

.tox-collection__item[aria-label="🔍 總結摘要框"] .tox-collection__item-label {
    border-top: 4px solid var(--box-accent-thinking) !important;
    background: var(--box-bg-thinking) !important;
    border-radius: 0 0 6px 6px !important;
}

.tox-collection__item[aria-label="📖 故事引言框"] .tox-collection__item-label {
    font-family: Georgia, serif !important;
    border-top: 2px solid var(--border-color) !important;
    border-bottom: 2px solid var(--border-color) !important;
    background: rgba(128, 128, 128, 0.05) !important;
    border-radius: 0 !important;
}

.tox-collection__item[aria-label="💬 對話泡泡框"] .tox-collection__item-label {
    background: var(--hover-bg) !important;
    border-radius: 16px !important;
    border-bottom-left-radius: 0 !important;
    display: inline-block !important;
    width: auto !important;
}

.tox-collection__item[aria-label="💻 程式碼說明框"] .tox-collection__item-label {
    font-family: Consolas, Monaco, monospace !important;
    background-color: var(--code-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-top: 3px solid var(--box-accent-thinking) !important;
    border-radius: 4px !important;
}

.tox-collection__item[aria-label="🤝 會議記錄框"] .tox-collection__item-label {
    border-top: 3px double var(--box-accent-success) !important;
    border-bottom: 3px double var(--box-accent-success) !important;
    background-color: rgba(40, 167, 69, 0.03) !important;
    border-radius: 0 !important;
}

.tox-collection__item[aria-label="✨ 亮點精句框"] .tox-collection__item-label {
    background-color: rgba(255, 193, 7, 0.03) !important;
    font-style: italic !important;
}

.tox-collection__item[aria-label="🎯 目標框"] .tox-collection__item-label {
    border: 1px dashed rgba(13, 202, 240, 0.4) !important;
    border-left: 6px solid var(--box-accent-info) !important;
    background-image: linear-gradient(135deg, rgba(13, 202, 240, 0.08) 0%, rgba(33, 150, 243, 0.02) 100%) !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🔒 私密安全框"] .tox-collection__item-label {
    border: 1px dashed var(--box-accent-tag) !important;
    background: repeating-linear-gradient(45deg, rgba(111, 66, 193, 0.03), rgba(111, 66, 193, 0.03) 10px, rgba(111, 66, 193, 0.06) 10px, rgba(111, 66, 193, 0.06) 20px) !important;
    border-radius: 6px !important;
}

.tox-collection__item[aria-label="📌 便籤貼 (Memo)"] .tox-collection__item-label {
    background-color: rgba(255, 235, 59, 0.07) !important;
    border-left: 5px solid var(--box-accent-warning) !important;
    border-top-right-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
}

.tox-collection__item[aria-label="🚧 施工警告框"] .tox-collection__item-label {
    border: 2px solid var(--box-accent-error) !important;
    background: repeating-linear-gradient(45deg, var(--box-bg-error), var(--box-bg-error) 10px, transparent 10px, transparent 20px) !important;
    border-radius: 4px !important;
}

.tox-collection__item[aria-label="📜 羊皮卷軸框"] .tox-collection__item-label {
    background: rgba(245, 222, 179, 0.1) !important;
    border: 4px double var(--box-accent-warning) !important;
    font-family: Georgia, serif !important;
}

.tox-collection__item[aria-label="🟢 優點區塊"] .tox-collection__item-label {
    border-top: 4px solid var(--box-accent-success) !important;
    background: linear-gradient(180deg, rgba(40, 167, 69, 0.08) 0%, transparent 100%) !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🔴 缺點區塊"] .tox-collection__item-label {
    border-top: 4px solid var(--box-accent-error) !important;
    background: linear-gradient(180deg, rgba(220, 53, 69, 0.08) 0%, transparent 100%) !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="✅ 完成區"] .tox-collection__item-label {
    border: 2px solid var(--box-accent-success) !important;
    background: repeating-linear-gradient(135deg, rgba(40, 167, 69, 0.05) 0px, rgba(40, 167, 69, 0.05) 10px, transparent 10px, transparent 20px) !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🚨 警示區"] .tox-collection__item-label {
    border: 3px solid var(--box-accent-error) !important;
    border-top: 12px solid var(--box-accent-error) !important;
    background-color: var(--box-bg-error) !important;
    border-radius: 6px !important;
}

.tox-collection__item[aria-label="📰 文字區"] .tox-collection__item-label {
    background: var(--hover-bg) !important;
    border: 2px dashed var(--border-color) !important;
    border-radius: 6px !important;
}

.tox-collection__item[aria-label="📐 邊框區"] .tox-collection__item-label {
    background: transparent !important;
    border: 2px dashed var(--border-color) !important;
    border-radius: 6px !important;
}

.tox-collection__item[aria-label="📦 自訂區"] .tox-collection__item-label {
    border: 2px dashed var(--text-muted) !important;
    background-color: var(--box-bg-note) !important;
    border-radius: 6px !important;
}

.tox-collection__item[aria-label="❓ 問題區"] .tox-collection__item-label {
    background-color: rgba(0, 123, 255, 0.1) !important;
    border: 2px dashed #007bff !important;
    border-radius: 6px !important;
}

.tox-collection__item[aria-label="🧪 答案區"] .tox-collection__item-label {
    background-color: rgba(23, 162, 184, 0.1) !important;
    border: 2px dashed #17a2b8 !important;
    border-radius: 6px !important;
}

.tox-collection__item[aria-label="🧾 代辦區"] .tox-collection__item-label {
    background-color: rgba(173, 181, 189, 0.1) !important;
    border: 2px dashed #adb5bd !important;
    border-radius: 12px !important;
}

.tox-collection__item[aria-label="🔔 提醒區"] .tox-collection__item-label {
    background-color: rgba(255, 193, 7, 0.1) !important;
    border: 2px dashed #ffc107 !important;
    border-radius: 12px !important;
}

.tox-collection__item[aria-label="📎 標籤區"] .tox-collection__item-label {
    border: 2px dashed var(--box-accent-tag) !important;
    background-color: var(--box-bg-tag) !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🌊 青色區塊"] .tox-collection__item-label {
    background-color: rgba(13, 202, 240, 0.08) !important;
    border: 2px dashed #0dcaf0 !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🌸 粉紅區塊"] .tox-collection__item-label {
    background-color: rgba(232, 62, 140, 0.08) !important;
    border: 2px dashed #e83e8c !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🍊 橘色區塊"] .tox-collection__item-label {
    background-color: rgba(253, 126, 20, 0.08) !important;
    border: 2px dashed #fd7e14 !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🟢 綠色區塊"] .tox-collection__item-label {
    background-color: rgba(40, 167, 69, 0.08) !important;
    border: 2px dashed #28a745 !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🔴 紅色區塊"] .tox-collection__item-label {
    background-color: rgba(220, 53, 69, 0.08) !important;
    border: 2px dashed #dc3545 !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🟤 棕色區塊"] .tox-collection__item-label {
    background-color: rgba(139, 69, 19, 0.08) !important;
    border: 2px dashed #8b4513 !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="🟡 黃色螢光筆"] .tox-collection__item-label {
    background-color: rgba(255, 235, 59, 0.35) !important;
}

.tox-collection__item[aria-label="🟢 綠色螢光筆"] .tox-collection__item-label {
    background-color: rgba(76, 175, 80, 0.3) !important;
}

.tox-collection__item[aria-label="🔵 藍色螢光筆"] .tox-collection__item-label {
    background-color: rgba(33, 150, 243, 0.25) !important;
}

.tox-collection__item[aria-label="🔴 紅色螢光筆"] .tox-collection__item-label {
    background-color: rgba(244, 67, 54, 0.25) !important;
}

.tox-collection__item[aria-label="🟣 紫色螢光筆"] .tox-collection__item-label {
    background-color: rgba(156, 39, 176, 0.25) !important;
}

.tox-collection__item[aria-label="🟠 橘色螢光筆"] .tox-collection__item-label {
    background-color: rgba(255, 152, 0, 0.3) !important;
}

.tox-collection__item[aria-label="⌨️ 鍵盤按鍵 (KBD)"] .tox-collection__item-label {
    background-color: var(--kbd-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
    box-shadow: 0 2px 0 var(--border-color) !important;
    width: auto !important;
    display: inline-block !important;
}

.tox-collection__item[aria-label="📟 行內程式碼"] .tox-collection__item-label {
    background-color: var(--code-header-bg) !important;
    color: var(--box-accent-warning) !important;
    border: 1px solid var(--border-color) !important;
    font-family: monospace !important;
    width: auto !important;
    display: inline-block !important;
}

.tox-collection__item[aria-label="🖊️ 下底波浪線"] .tox-collection__item-label {
    text-decoration: underline wavy var(--box-accent-error) !important;
}

.tox-collection__item[aria-label="🖊️ 下底虛線"] .tox-collection__item-label {
    border-bottom: 2px dashed var(--box-accent-info) !important;
    border-radius: 0 !important;
}

.tox-collection__item[aria-label="👻 劇透防雷 (Spoiler)"] .tox-collection__item-label {
    background-color: var(--text-color) !important;
    color: var(--text-color) !important;
    width: auto !important;
    display: inline-block !important;
    border-radius: 4px !important;
}

.tox-collection__item[aria-label="🌈 彩虹漸層字"] .tox-collection__item-label {
    background-image: linear-gradient(to right, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff) !important;
    -webkit-background-clip: text !important;
    color: transparent !important;
    width: auto !important;
    display: inline-block !important;
    font-weight: bold !important;
}

.tox-collection__item[aria-label="🏷️ 圓角小標籤"] .tox-collection__item-label {
    background-color: var(--hover-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    width: auto !important;
    display: inline-block !important;
    padding: 2px 8px !important;
}

.tox-collection__item[aria-label="✨ 霓虹發光字"] .tox-collection__item-label {
    color: #fff !important;
    text-shadow: 0 0 5px var(--box-accent-info), 0 0 10px var(--box-accent-info) !important;
    background: #1a1a1a !important;
    width: auto !important;
    display: inline-block !important;
    border-radius: 4px !important;
}

.tox-collection__item[aria-label="🔨 立體雕刻字"] .tox-collection__item-label {
    color: var(--bg-color) !important;
    text-shadow: 1px 1px 1px var(--text-muted) !important;
    background: var(--text-color) !important;
    font-weight: bold !important;
    width: auto !important;
    display: inline-block !important;
}

.tox-collection__item[aria-label="🔘 3D 模擬按鈕"] .tox-collection__item-label {
    background: var(--code-header-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 3px 0 var(--border-color) !important;
    border-radius: 6px !important;
    font-weight: bold !important;
    width: auto !important;
    display: inline-block !important;
}

.tox-collection__item[aria-label="🔍 放大鏡重點"] .tox-collection__item-label {
    font-size: 1.1em !important;
    font-weight: 900 !important;
    color: var(--box-accent-error) !important;
    width: auto !important;
    display: inline-block !important;
}

.tox-collection__item[aria-label="雙欄並排 (50% / 50%)"] .tox-collection__item-label {
    display: flex !important;
    gap: 8px !important;
    padding: 6px 12px !important;
}

.tox-collection__item[aria-label="雙欄並排 (50% / 50%)"] .tox-collection__item-label::before,
.tox-collection__item[aria-label="雙欄並排 (50% / 50%)"] .tox-collection__item-label::after {
    content: "欄位" !important;
    flex: 1 !important;
    border: 1px dashed var(--border-color) !important;
    text-align: center !important;
    font-size: 0.8em !important;
    color: var(--text-muted) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-radius: 4px !important;
}

.tox-collection__item[aria-label="三欄並排 (33% * 3)"] .tox-collection__item-label {
    display: flex !important;
    gap: 6px !important;
    padding: 6px 12px !important;
}

.tox-collection__item[aria-label="三欄並排 (33% * 3)"] .tox-collection__item-label::before {
    content: "欄位 / 欄位 / 欄位" !important;
    flex: 1 !important;
    border: 1px dashed var(--border-color) !important;
    text-align: center !important;
    font-size: 0.8em !important;
    color: var(--text-muted) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-radius: 4px !important;
}

.tox-collection__item[aria-label="區塊欄位 (置入內容用)"] .tox-collection__item-label {
    border: 1.5px dashed var(--border-color) !important;
    background: rgba(255, 255, 255, 0.01) !important;
    border-radius: 6px !important;
    color: var(--text-color) !important;
}

.tox-collection__item[aria-label="卡片網格"] .tox-collection__item-label {
    display: flex !important;
    gap: 8px !important;
    padding: 6px 12px !important;
}

.tox-collection__item[aria-label="卡片網格"] .tox-collection__item-label::before {
    content: "🎴 卡片網格 (雙欄/多欄自動排列)" !important;
    flex: 1 !important;
    border: 1px dashed var(--border-color) !important;
    border-radius: 6px !important;
    text-align: center !important;
    font-size: 0.8em !important;
    color: var(--text-muted) !important;
}

.tox-collection__item[aria-label="獨立卡片"] .tox-collection__item-label {
    background: var(--code-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15) !important;
    color: var(--text-color) !important;
    border-radius: 8px !important;
}

.tox-collection__item[aria-label="時間軸步驟容器"] .tox-collection__item-label {
    border-left: 2px solid var(--border-color) !important;
    padding-left: 16px !important;
    border-radius: 0 !important;
    color: var(--text-color) !important;
}

.tox-collection__item[aria-label="時間軸節點 (列)"] .tox-collection__item-label {
    position: relative !important;
    padding-left: 20px !important;
    color: var(--text-color) !important;
}

.tox-collection__item[aria-label="時間軸節點 (列)"] .tox-collection__item-label::before {
    content: "" !important;
    position: absolute !important;
    left: 4px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: var(--bg-color) !important;
    border: 2px solid var(--box-accent-thinking) !important;
}

/* ==========================================================================
      Notion-like 自訂 HTML / 斜線浮動指令選單樣式
   ========================================================================== */
.notion-slash-menu {
    position: absolute;
    z-index: 999999;
    width: 320px;
    max-height: 380px;
    background: rgba(30, 34, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(255, 255, 255, 0.05);
    overflow-y: auto;
    padding: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #e2e8f0;
    scroll-behavior: smooth;
}

.notion-slash-menu::-webkit-scrollbar {
    width: 6px;
}

.notion-slash-menu::-webkit-scrollbar-track {
    background: transparent;
}

.notion-slash-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.notion-slash-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notion-slash-menu .menu-group-title {
    padding: 6px 10px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notion-slash-menu .menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.15s ease, transform 0.1s ease;
    margin-bottom: 2px;
    user-select: none;
}

.notion-slash-menu .menu-item:hover,
.notion-slash-menu .menu-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.notion-slash-menu .menu-item.active {
    border-left: 3px solid var(--box-accent-info, #0dcaf0);
    padding-left: 7px;
}

.notion-slash-menu .menu-item-text {
    font-weight: 500;
}

.notion-slash-menu .menu-item-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    color: #a0aec0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.notion-slash-menu .menu-item.active .menu-item-badge {
    background: rgba(13, 202, 240, 0.15);
    color: #0dcaf0;
    border-color: rgba(13, 202, 240, 0.2);
}

/* =========================================
   20. Page Break (分頁符號樣式控制)
   ========================================= */
@media screen {
    /* 前台瀏覽時，隱藏分頁符號 (因為前台是無限卷軸往下看，不需要實體分頁線) */
    body:not(.mce-content-body) .mce-pagebreak {
        display: none !important;
    }
    
    /* 編輯器內部，覆蓋原版預設很寬高的圖片分頁符號，改為一條細緻的虛線，減少佔用空間 */
    body.mce-content-body .mce-pagebreak {
        display: block !important;
        height: 2px !important;
        width: 100% !important;
        margin: 20px 0 !important;
        border: none !important;
        border-top: 2px dashed #ccc !important;
        background: transparent !important;
        cursor: default !important;
        box-shadow: none !important;
        opacity: 0.8;
    }
}

/* =========================================
   21. Playground Embed (自製小程式嵌入卡片)
   ========================================= */
.playground-embed-wrapper,
div.playground-embed-wrapper {
    margin-top: 24px !important;
    margin-bottom: 24px !important;
    width: auto !important;
    max-width: 100% !important;
    height: 780px !important;
    min-height: 780px !important;
    max-height: 780px !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    background: #020617 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    box-sizing: border-box !important;
    transition: margin-left 0.2s ease, padding-left 0.2s ease;
}

.playground-embed-wrapper iframe,
div.playground-embed-wrapper iframe {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 734px !important;
    min-height: 734px !important;
    max-height: 734px !important;
    border: none !important;
    display: block !important;
    background: #020617 !important;
    box-sizing: border-box !important;
}

/* 縮排、凸排與移除按鈕：編輯器內顯示，前台閱讀時自動隱藏 */
.btn-remove-embed-widget,
.btn-indent-embed-widget,
.btn-outdent-embed-widget {
    display: none !important;
    transition: all 0.18s ease;
}

body.mce-content-body .btn-remove-embed-widget,
body.mce-content-body .btn-indent-embed-widget,
body.mce-content-body .btn-outdent-embed-widget {
    display: inline-flex !important;
}

.playground-embed-header {
    cursor: grab !important;
}

body.mce-content-body .playground-embed-header:active {
    cursor: grabbing !important;
}

.btn-remove-embed-widget:hover {
    background: rgba(239, 68, 68, 0.35) !important;
    color: #fff !important;
    border-color: #ef4444 !important;
}

.btn-indent-embed-widget:hover,
.btn-outdent-embed-widget:hover {
    background: rgba(56, 189, 248, 0.3) !important;
    color: #fff !important;
    border-color: #38bdf8 !important;
}