.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 {
    /* [Zoom] 作为 zoom 控件的定位锚点 */
    position: relative;
    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 设置 (setupCanvasSize + setZoom 按档位缩放) */
    /* 修复：移除行高带来的间隙，确保 Canvas 紧贴 */
    line-height: 0;
    /* 手机上画布可能超出容器宽度, 确保不破坏布局 */
    max-width: 100%;
}


#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 双保险 */
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}


.sam-zoom-bar {
    position: absolute;
    right: 18px;
    bottom: 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dce4ec;
    border-radius: 8px;
    padding: 4px 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 20;
    user-select: none;
    -webkit-user-select: none;
}

.sam-zoom-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: #ecf0f1;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.sam-zoom-btn:hover:not(:disabled) { background: #bdc3c7; }
.sam-zoom-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.sam-zoom-value {
    min-width: 52px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.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);
}
