* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.sidebar h3 {
    font-size: 14px;
    margin: 15px 0 10px;
    color: #555;
    font-weight: 600;
}

.section {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.input-range-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-range-group input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

.input-range-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.input-range-group input[type="number"] {
    width: 40px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
}

.hint {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.instructions {
    list-style: none;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.instructions li {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    padding-left: 15px;
    position: relative;
}

.instructions li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 24px;
}

.left-controls {
    position: absolute;
    left: 24px;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.canvas-settings-wrapper,
.action-buttons-wrapper,
.image-settings-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #667eea;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.toggle-btn:hover {
    background: #667eea;
    color: white;
}

.canvas-settings {
    background: rgba(248, 249, 250, 0.95);
    border-radius: 8px;
    padding: 12px;
    min-width: 180px;
    transition: opacity 0.3s, transform 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.canvas-settings.hidden {
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
    display: none;
}

.canvas-settings h4 {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
}

.canvas-settings-row {
    margin-bottom: 10px;
}

.mini-form-group {
    display: flex;
    flex-direction: column;
}

.mini-form-group label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.mini-form-group input[type="number"],
.mini-form-group input[type="color"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.9);
}

.mini-form-group input[type="color"] {
    padding: 2px;
    height: 32px;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    transition: opacity 0.3s, transform 0.3s;
}

.action-buttons.hidden {
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
    display: none;
}

.image-settings-panel {
    background: rgba(248, 249, 250, 0.95);
    border-radius: 8px;
    padding: 12px;
    min-width: 180px;
    max-height: 400px;
    overflow-y: auto;
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    display: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.image-settings-panel.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    display: block;
}

/* 浮动图片设置按钮 */
.floating-settings-btn {
    position: fixed;
    width: 40px;
    height: 40px;
    background: rgba(102, 126, 234, 0.9);
    border: 2px solid #fff;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    pointer-events: none;
}

.floating-settings-btn.show {
    opacity: 1;
    pointer-events: auto;
}

.floating-settings-btn:hover {
    background: #667eea;
    transform: scale(1.1);
}

.image-settings-panel h4 {
    font-size: 14px;
    color: #333;
    margin-bottom: 10px;
}

.image-settings-row {
    margin-bottom: 10px;
}

.action-buttons .btn {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.right-controls {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 100;
}

.zoom-bar-container {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.zoom-level {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.zoom-slider {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 6px;
    height: 150px;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

#canvasContainer {
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: visible;
    transform-origin: center center;
}

#canvasContainer.panning {
    cursor: grabbing;
}

#canvas {
    display: block;
}

#imageOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.image-item {
    position: absolute;
    cursor: move;
    transition: box-shadow 0.2s;
}

.image-item:hover {
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5);
}

.image-item.selected {
    box-shadow: 0 0 0 2px #667eea;
}

.image-item img {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    border-radius: inherit;
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    z-index: 10;
}

.resize-handle:hover {
    background: #667eea;
}

.resize-handle.nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.rotate-line {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 30px;
    background: #667eea;
}

.rotate-handle {
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: grab;
    z-index: 10;
}

.rotate-handle:hover {
    background: #667eea;
}

.pan-control {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 100;
}

.pan-circle {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    position: relative;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pan-dot {
    width: 16px;
    height: 16px;
    background: rgba(102, 126, 234, 0.8);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.2s;
}

.pan-dot:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.pan-dot:active {
    cursor: grabbing;
}

/* 响应式设计 */
@media (min-width: 481px) {
    .use-on-mobile {
        display: none;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .left-controls {
        left: 16px;
        top: 16px;
    }
    
    .right-controls {
        right: 16px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        padding: 15px;
    }
    
    .sidebar h2 {
        font-size: 16px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .left-controls {
        left: 12px;
        top: 12px;
        gap: 8px;
    }
    
    .canvas-settings,
    .action-buttons {
        min-width: 150px;
    }
    
    .right-controls {
        right: 12px;
    }
    
    .zoom-bar-container {
        padding: 12px 8px;
    }
    
    .zoom-slider {
        height: 120px;
    }
    
    .pan-control {
        bottom: 16px;
        left: 16px;
    }
    
    .pan-circle {
        width: 60px;
        height: 60px;
    }
    
    .pan-dot {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        display: none;
    }
    
    .image-settings-mobile {
        display: block !important;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 320px;
        max-height: 80vh;
        overflow-y: auto;
        background: rgba(255, 255, 255, 0.98);
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        z-index: 1000;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .left-controls {
        left: 8px;
        top: 8px;
    }
    
    .canvas-settings,
    .action-buttons {
        min-width: 130px;
        padding: 10px;
    }
    
    .canvas-settings h4 {
        font-size: 12px;
    }
    
    .right-controls {
        right: 8px;
    }
    
    .zoom-slider {
        height: 100px;
    }
    
    .pan-control {
        bottom: 12px;
        left: 12px;
    }
}
