/* 拼豆游戏样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

main {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.game-area {
    flex: 1;
    min-width: 300px;
}

.toolbar {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.color-palette {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.brand-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.brand-selector label {
    font-size: 0.9rem;
    color: #555;
}

.brand-selector select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.colors-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: #333;
    transform: scale(1.15);
}

.tools {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.tool-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.board-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

#gameBoard {
    border: 2px solid #333;
    cursor: crosshair;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #5a6fd6;
}

.action-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.preview-area {
    width: 300px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    align-self: flex-start;
}

.preview-area h3 {
    margin-bottom: 15px;
    color: #667eea;
}

#previewCanvas {
    width: 100%;
    border: 1px solid #ddd;
    margin-bottom: 15px;
}

.pattern-info p {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.progress-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.progress-section h4 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1rem;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

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

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

.color-progress h5 {
    margin-bottom: 10px;
    color: #555;
    font-size: 0.9rem;
}

.color-progress-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.color-progress-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.color-progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.color-progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.3s ease;
}

.color-progress-text {
    min-width: 40px;
    text-align: right;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

/* 图片导入样式 */
.image-import {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.image-import h4 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1rem;
}

.import-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.file-btn:hover {
    background: #5a6fd6;
}

.file-info {
    font-size: 0.8rem;
    color: #666;
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.conversion-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    min-width: 80px;
    font-size: 0.9rem;
    color: #555;
}

.setting-group select,
.setting-group input[type="number"] {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.setting-group input[type="range"] {
    flex: 1;
    max-width: 150px;
}

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

.action-btn.secondary {
    background: #6c757d;
}

.action-btn.secondary:hover {
    background: #5a6268;
}

.color-usage {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.color-usage h4 {
    margin-bottom: 10px;
    color: #667eea;
    font-size: 0.9rem;
}

.usage-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.usage-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #ddd;
}

.usage-count {
    color: #666;
}

/* 对话框通用样式 */
.iron-dialog,
.save-dialog,
.load-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.iron-dialog-content,
.save-dialog-content,
.load-dialog-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.iron-dialog-content h3,
.save-dialog-content h3,
.load-dialog-content h3 {
    margin-bottom: 20px;
    color: #667eea;
    text-align: center;
}

/* 熨烫对话框样式 */
.iron-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.iron-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.iron-option label {
    min-width: 80px;
    font-size: 0.9rem;
    color: #555;
}

.iron-option select,
.iron-option input[type="range"] {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.iron-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 保存对话框样式 */
.save-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.save-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: #f8f9ff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.save-option-btn:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.save-icon {
    font-size: 2rem;
}

/* 加载对话框样式 */
.design-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.design-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.design-item:hover {
    background: #f8f9ff;
}

.design-name {
    flex: 1;
    font-weight: 500;
}

.design-date {
    font-size: 0.8rem;
    color: #666;
}

.delete-design-btn {
    padding: 5px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.delete-design-btn:hover {
    background: #c82333;
}

/* 图案库对话框样式 */
.pattern-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.pattern-dialog-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.pattern-dialog-content h3 {
    margin-bottom: 20px;
    color: #667eea;
    text-align: center;
}

.pattern-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.category-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-btn:hover {
    border-color: #667eea;
}

.category-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

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

.pattern-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.pattern-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.pattern-preview {
    margin-bottom: 10px;
    text-align: center;
}

.pattern-canvas {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pattern-info h4 {
    margin-bottom: 8px;
    color: #333;
}

.pattern-info p {
    margin-bottom: 4px;
    font-size: 0.8rem;
    color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    .preview-area {
        width: 100%;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .image-import {
        margin-top: 15px;
    }
    
    .setting-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .setting-group label {
        min-width: auto;
    }
    
    .setting-group select,
    .setting-group input[type="number"],
    .setting-group input[type="range"] {
        width: 100%;
    }
    
    .iron-dialog-content {
        padding: 20px;
    }
}