.wb-tool-wrapper { --p-bg: #ffffff; --p-border: #e2e8f0; --p-primary: #3b82f6; --p-primary-hover: #2563eb; --p-text: #0f172a; width: 100%; max-width: 1200px; margin: 0 auto; background: var(--p-bg); border-radius: 20px; padding: 24px; border: 1px solid var(--p-border); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); }
.wb-header-main { font-size: 1.6rem; font-weight: 800; color: var(--p-text); margin-bottom: 12px; text-align: center; }
.wb-subtitle { color: #64748b; font-size: 0.95rem; padding-bottom: 20px; border-bottom: 1px solid var(--p-border); margin-bottom: 24px; text-align: center; max-width: 800px; margin-left: auto; margin-right: auto; line-height: 1.6; }

.wb-layout { display: flex; flex-direction: column; gap: 16px; }

/* 顶部工具栏 */
.wb-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; background: #f8fafc; padding: 12px 20px; border-radius: 12px; border: 1px solid var(--p-border); }
.wb-toolbar-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wb-divider { width: 1px; height: 24px; background: #cbd5e1; margin: 0 4px; }

/* 颜色选择器 */
.wb-color-input { -webkit-appearance: none; -moz-appearance: none; appearance: none; width: 36px; height: 36px; background: transparent; border: none; cursor: pointer; padding: 0; border-radius: 50%; overflow: hidden; }
.wb-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.wb-color-input::-webkit-color-swatch { border: 2px solid #cbd5e1; border-radius: 50%; }
.wb-color-input:hover::-webkit-color-swatch { border-color: var(--p-primary); }

/* 工具按钮 */
.wb-tool-btn { width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; background: #ffffff; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.wb-tool-btn:hover { background: #e0e7ff; }
.wb-tool-btn.active { background: #e0e7ff; border-color: var(--p-primary); box-shadow: 0 2px 8px rgba(59,130,246,0.2); }

/* 粗细滑块 */
.wb-slider-group { display: flex; align-items: center; gap: 8px; background: #ffffff; padding: 8px 12px; border-radius: 10px; border: 1px solid #cbd5e1; }
.wb-slider { -webkit-appearance: none; width: 100px; height: 4px; background: #cbd5e1; border-radius: 2px; outline: none; }
.wb-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--p-primary); cursor: pointer; transition: 0.2s; }
.wb-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.wb-size-val { font-size: 0.85rem; font-family: monospace; color: #475569; width: 30px; text-align: right; }

/* 动作按钮 */
.wb-action-btn { padding: 8px 16px; border-radius: 8px; border: 1px solid #cbd5e1; background: #ffffff; color: #334155; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 6px; }
.wb-action-btn:hover { background: #f1f5f9; border-color: #94a3b8; }
.wb-btn-primary { background: var(--p-primary); color: white; border-color: var(--p-primary); }
.wb-btn-primary:hover { background: var(--p-primary-hover); border-color: var(--p-primary-hover); color: white; }

/* 画布容器 */
.wb-canvas-container { width: 100%; height: 600px; border: 2px solid #cbd5e1; border-radius: 12px; overflow: hidden; background: #ffffff; position: relative; cursor: crosshair; box-shadow: inset 0 2px 10px rgba(0,0,0,0.02); }
#wbCanvas { display: block; width: 100%; height: 100%; touch-action: none; /* 阻止移动端默认滚动，允许画布内画画 */ }

/* 黑夜模式强力覆盖 */
[data-theme="dark"] .wb-tool-wrapper { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .wb-header-main { color: #f8fafc; }
[data-theme="dark"] .wb-toolbar { background: #0f172a; border-color: #475569; }
[data-theme="dark"] .wb-divider { background: #475569; }
[data-theme="dark"] .wb-color-input::-webkit-color-swatch { border-color: #475569; }
[data-theme="dark"] .wb-tool-btn, [data-theme="dark"] .wb-slider-group, [data-theme="dark"] .wb-action-btn { background: #1e293b; border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .wb-tool-btn:hover, [data-theme="dark"] .wb-action-btn:hover { background: #334155; }
[data-theme="dark"] .wb-tool-btn.active { background: rgba(59,130,246,0.2); border-color: var(--p-primary); }
[data-theme="dark"] .wb-slider { background: #475569; }
[data-theme="dark"] .wb-size-val { color: #cbd5e1; }
[data-theme="dark"] .wb-btn-primary { background: var(--p-primary); color: white; border-color: var(--p-primary); }

/* 注意：画布本体 #wbCanvas 保持白色背景，这样黑夜模式下也是一个真正的“白板”并能导出白底图片 */
[data-theme="dark"] .wb-canvas-container { border-color: #475569; }
/* =======================================
   全屏沉浸模式 (Fullscreen Overlay)
   ======================================= */
.wb-tool-wrapper:fullscreen {
    max-width: 100% !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    background: var(--p-bg);
    overflow: hidden;
}

/* 兼容旧版 Safari 伪类 */
.wb-tool-wrapper:-webkit-full-screen {
    max-width: 100% !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    background: var(--p-bg);
}

.wb-tool-wrapper:fullscreen .wb-layout,
.wb-tool-wrapper:-webkit-full-screen .wb-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100% - 60px); /* 减去顶部标题的高度 */
}

/* 全屏时，让画布区域占满剩下的所有空间，覆盖原本的 600px 高度 */
.wb-tool-wrapper:fullscreen .wb-canvas-container,
.wb-tool-wrapper:-webkit-full-screen .wb-canvas-container {
    flex: 1;
    height: auto;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
}