* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 95%;
}

.app-wrapper {
    width: 100%;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

h1::after {
    content: "🎨";
    position: absolute;
    right: -30px;
    top: 0;
}

h2 {
    margin-bottom: 15px;
    color: #444;
}

.color-section {
    display: flex;
    margin-bottom: 30px;
}

.color-palette {
    flex: 1;
    margin-right: 20px;
}

.mixing-section {
    flex: 1;
}

.basic-colors {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.color-box {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.color-box:hover, .color-box:active {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-box.selected {
    transform: scale(0.95);
    box-shadow: 0 0 0 3px #333;
}

.color-box.selected::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5rem;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.selected-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    min-height: 60px;
}

.selected-color-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

.selected-color-sample {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
}

.remove-color {
    margin-left: 8px;
    cursor: pointer;
    color: #999;
    font-weight: bold;
}

.remove-color:hover {
    color: #ff3333;
}

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

button {
    padding: 10px 15px;
    margin-right: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

button:active {
    transform: scale(0.95);
}

#mix-button {
    background-color: #4CAF50;
    color: white;
    position: relative;
}

#mix-button::after {
    content: "🔮";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
}

#mix-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#mix-button:not(:disabled):hover {
    background-color: #45a049;
}

#clear-button {
    background-color: #f0f0f0;
    color: #333;
}

#clear-button:hover {
    background-color: #e0e0e0;
}

.result-section {
    margin-top: 20px;
}

.result-container {
    display: flex;
    align-items: center;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.result-color {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    margin-right: 20px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
    transition: all 0.5s ease;
}

.result-color.show-result {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.result-info {
    flex: 1;
}

.result-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
}

.result-rgb {
    color: #666;
}

.touch-device .color-box {
    margin-bottom: 5px;
}

.touch-device .color-box:active {
    transform: scale(0.95);
}

.touch-device button {
    min-height: 44px; /* 确保触摸区域足够大 */
}

@media (max-width: 768px) {
    .color-section {
        flex-direction: column;
    }
    
    .color-palette {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .basic-colors {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .result-container {
        flex-direction: column;
        text-align: center;
    }
    
    .result-color {
        margin-right: 0;
        margin-bottom: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .container {
        width: 100%;
        padding: 10px;
    }
    
    h1 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    h1::after {
        right: -25px;
        font-size: 0.9em;
    }
    
    h2 {
        font-size: 1rem;
        margin-bottom: 5px;
    }
    
    .color-section {
        margin-bottom: 15px;
    }
    
    .color-palette {
        margin-bottom: 8px;
    }
    
    .basic-colors {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .color-box {
        height: 0;
        padding-bottom: 70%; /* 控制高度为宽度的70% */
    }
    
    .color-box.selected::after {
        font-size: 1rem;
    }
    
    .selected-colors {
        gap: 5px;
        margin-bottom: 8px;
        min-height: 40px;
    }
    
    .selected-color-item {
        padding: 2px 5px;
        font-size: 0.8rem;
    }
    
    .selected-color-sample {
        width: 15px;
        height: 15px;
    }
    
    .mixing-section {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
    }
    
    .mixing-section h2 {
        width: 100%;
    }
    
    .mixing-section .selected-colors {
        width: 100%;
    }
    
    .button-group {
        display: flex;
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
    
    button {
        padding: 6px 12px;
        font-size: 0.9rem;
        margin-bottom: 0;
        width: 48%;
        max-width: none;
    }
    
    #mix-button, #clear-button {
        height: 36px;
    }
    
    #mix-button::after {
        font-size: 1em;
        right: 5px;
    }
    
    .result-section {
        margin-top: 10px;
    }
    
    .result-container {
        padding: 10px;
    }
    
    .result-color {
        width: 60px;
        height: 60px;
    }
    
    .result-name {
        font-size: 1.1rem;
        margin-bottom: 3px;
    }
    
    .result-rgb {
        font-size: 0.7rem;
    }
}
