* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: #f5f5f5;
}

.control-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

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

.control-group label {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.control-group input[type="color"] {
    width: 40px;
    height: 32px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.control-group input[type="file"] {
    font-size: 12px;
    max-width: 200px;
}

.control-group button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    background: #e0e0e0;
    color: #333;
}

.control-group button:hover {
    background: #d0d0d0;
}

.export-btn {
    background: #000 !important;
    color: #fff !important;
    font-weight: 600;
}

.export-btn:hover {
    background: #333 !important;
}

.canvas-container {
    margin-top: 100px;
    width: 600px;
    padding: 40px 30px 60px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.header {
    margin-bottom: 30px;
    z-index: 1;
}

.title-box {
    background: #000;
    color: #fff;
    padding: 14px 50px;
    font-size: 30px;
    font-weight: bold;
    font-style: italic;
    letter-spacing: 1px;
}

.grid-layout {
    position: relative;
    width: 100%;
}

.box {
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    overflow: hidden;
    background: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.box:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.label {
    font-size: 12px;
    color: #333;
    text-align: center;
    line-height: 1.35;
    padding: 4px;
    pointer-events: none;
    font-weight: 400;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.preview {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    pointer-events: none;
    z-index: 5;
}

.preview[src=""],
.preview:not([src]) {
    display: none !important;
}

.preview.active {
    display: block;
}

.box.has-image .label {
    display: none;
}

@media (max-width: 650px) {
    .control-panel {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }
    
    .control-group {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .canvas-container {
        margin-top: 180px;
        width: 100%;
        max-width: 420px;
        padding: 25px 15px 40px;
    }
    
    .title-box {
        font-size: 22px;
        padding: 10px 35px;
    }
}
