* {
    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%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #2d3748;
    margin-bottom: 10px;
}

header p {
    color: #718096;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
}

.drop-zone {
    border: 3px dashed #cbd5e0;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.drop-zone:hover {
    border-color: #667eea;
    background: #f7fafc;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.hint {
    font-size: 0.85em;
    color: #718096;
    margin-top: 5px;
}

.file-info {
    margin-top: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
}

/* 选项区域 */
.options-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
}

.options-section h3 {
    margin-bottom: 15px;
    color: #2d3748;
}

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: block;
    color: #4a5568;
    margin-bottom: 5px;
}

.option-group select,
.option-group input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 1em;
    width: 100%;
    max-width: 300px;
}

.option-group input[type="range"] {
    width: 200px;
    vertical-align: middle;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 进度条 */
.progress-section {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e2e8f0;
    border-radius: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    color: #4a5568;
}

/* 调试面板 */
.debug-panel {
    margin-bottom: 30px;
    padding: 20px;
    background: #1a202c;
    border-radius: 8px;
    color: #e2e8f0;
}

.debug-panel h3 {
    color: #e2e8f0;
    margin-bottom: 10px;
}

.debug-log {
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
}

.log-entry {
    padding: 5px;
    border-bottom: 1px solid #2d3748;
}

.log-info {
    color: #90cdf4;
}

.log-success {
    color: #68d391;
}

.log-warning {
    color: #fbd38d;
}

.log-error {
    color: #fc8181;
}

.log-header {
    color: #e2e8f0;
    font-weight: bold;
}

/* 预览区域 */
.preview-section {
    margin-bottom: 30px;
}

.preview-section h3 {
    margin-bottom: 15px;
    color: #2d3748;
}

.preview-header,
.boundary-editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.preview-header {
    margin-bottom: 15px;
}

.preview-header h3 {
    margin-bottom: 0;
}

.boundary-editor-toolbar {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
}

.boundary-editor-toolbar .hint {
    margin-top: 3px;
}

.boundary-dirty-indicator {
    color: #64748b;
    font-size: 0.9rem;
}

.boundary-dirty-indicator.is-dirty {
    color: #c2410c;
    font-weight: 700;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.preview-item {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    min-width: 0;
}

.preview-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.preview-item img {
    width: 100%;
    display: block;
}

.preview-item.is-editable {
    border-color: #f97316;
}

.boundary-window {
    position: relative;
    overflow: hidden;
    background: #e2e8f0;
    touch-action: none;
}

.boundary-source-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: none;
    pointer-events: none;
}

.boundary-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 3px solid #f97316;
    pointer-events: none;
    z-index: 2;
}

.boundary-line.top {
    top: 0;
}

.boundary-line.bottom {
    bottom: 0;
}

.boundary-drag-handle {
    position: absolute;
    left: 50%;
    bottom: -13px;
    transform: translateX(-50%);
    width: 44px;
    height: 24px;
    border-radius: 12px;
    border: 0;
    background: #f97316;
    color: white;
    cursor: ns-resize;
    touch-action: none;
    z-index: 3;
}

.boundary-controls {
    padding: 10px;
    background: #fff7ed;
    border-top: 1px solid #fed7aa;
    font-size: 0.82rem;
}

.boundary-step-row {
    display: flex;
    gap: 4px;
    margin-top: 7px;
}

.boundary-step-row button {
    flex: 1;
    border: 1px solid #fdba74;
    border-radius: 5px;
    background: white;
    color: #9a3412;
    padding: 5px 2px;
    cursor: pointer;
}

.boundary-step-row button:hover {
    background: #ffedd5;
}

.boundary-coordinate-input {
    width: 82px;
    padding: 4px 6px;
    border: 1px solid #fdba74;
    border-radius: 5px;
}

.preview-item p {
    padding: 8px;
    text-align: center;
    background: #f7fafc;
    color: #4a5568;
    font-size: 0.9em;
}

.boundary-page-label {
    margin-top: -1px;
}

.export-section {
    display: flex;
    gap: 10px;
    justify-content: center;
}
/* 文件名输入框 */
.filename-input-group {
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filename-input-group label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
}

.filename-input-group .label-icon {
    margin-right: 8px;
}

.filename-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.filename-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filename-input::placeholder {
    color: #a0aec0;
}

.filename-hint {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #718096;
    line-height: 1.5;
}

/* 导出按钮区域调整 */
.export-buttons {
    margin-bottom: 30px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .filename-input-group {
        padding: 15px;
    }
    
    .filename-input {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .filename-hint {
        font-size: 12px;
    }
}

/* 浮动按钮 */
.float-buttons {
    position: fixed;
    right: 30px;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.float-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

.float-btn.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.float-btn:active {
    transform: scale(0.95);
}

/* 按钮图标 */
.float-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 顶部按钮 */
.float-btn.to-top {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 底部按钮 */
.float-btn.to-bottom {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* 操作区按钮 */
.float-btn.to-options {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    font-size: 14px;
    width: 56px;
    height: 56px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .float-buttons {
        right: 15px;
        bottom: 15px;
    }
    
    .float-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

/* 添加动画 */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float-btn.bounce {
    animation: bounce 0.6s ease;
}
