.sam-content-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 900px;
}

.sam-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sam-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
}

.sam-btn-primary {
    background-color: #3498db;
    color: white;
}
.sam-btn-primary:hover { background-color: #2980b9; }

.sam-btn-default {
    background-color: #ecf0f1;
    color: #7f8c8d;
}
.sam-btn-default:hover:not(:disabled) { background-color: #bdc3c7; }
.sam-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.sam-status {
    font-size: 14px;
    color: #e67e22;
    font-weight: 500;
}

.sam-error-msg {
    color: #e74c3c;
    min-height: 20px;
    font-size: 14px;
    margin-bottom: 15px;
}

/* Canvas 容器核心样式 */
.sam-workspace {
    width: 100%;
    display: flex;
    justify-content: center;
    background-color: #f8f9fa;
    border: 2px dashed #dce4ec;
    border-radius: 6px;
    padding: 10px;
    box-sizing: border-box;
    /* 修复：防止绘图时意外选中文字 */
    user-select: none;
    -webkit-user-select: none;
    /* 修复：防止 Canvas 溢出容器 */
    overflow: hidden;
}

.canvas-wrapper {
    position: relative;
    /* 由 JS 动态设置宽高 */
    /* 修复：移除行高带来的间隙，确保 Canvas 紧贴 */
    line-height: 0;
    /* 手机上画布可能超出容器宽度, 确保不破坏布局 */
    max-width: 100%;
}

/* 修复：拆分 Canvas 样式以精确控制层级和交互 */

/* 底图 Canvas */
#canvas-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* 遮罩层 Canvas */
#canvas-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* 交互绘制层 Canvas */
#canvas-draw {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: auto;
    cursor: crosshair;
    /* 移动端关键: 告诉浏览器"此元素的触摸手势归 JS 管",
       不再触发页面滚动/缩放; 与 JS 端 preventDefault 双保险<span data-allow-html class='source-item source-aggregated' data-group-key='source-group-3' data-url='https://webplatform&#46;github&#46;io/docs/css/properties/touch&#45;action/' data-id='turn0search1'><span data-allow-html class='source-item-num' data-group-key='source-group-3' data-id='turn0search1' data-url='https://webplatform&#46;github&#46;io/docs/css/properties/touch&#45;action/'><span class='source-item-num-name' data-allow-html>github.io</span><span data-allow-html class='source-item-num-count'>+1</span></span></span> */
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

/* 提示框样式复用你的风格 */
.sam-info-box {
    margin-top: 30px;
    max-width: 900px;
    background: #ebf5fb;
    padding: 20px;
    border-radius: 8px;
    color: #2980b9;
}
.sam-info-box h3 { margin-top: 0; font-size: 16px; }
.sam-info-box ul { margin: 10px 0 0 0; padding-left: 20px; font-size: 14px; line-height: 1.8; }

.sam-btn-success {
    background-color: #27ae60;
    color: white;
}
.sam-btn-success:hover { background-color: #219653; }

#sam-toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(44, 62, 80, 0.92);
    color: #fff;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 9999;
    max-width: 80vw;
}
#sam-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
