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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: #fff;
    color: #000;
    line-height: 1.6;
}

.card {
    border: 1px solid #ddd;
    background: #fff;
    padding: 24px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.section-header p {
    font-size: 13px;
    color: #666;
}

.drop-zone {
    border: 2px dashed #d1d5db;
    padding: 48px 20px;
    text-align: center;
    cursor: pointer;
    transition: border 0.2s ease, background 0.2s ease;
    background: #fafafa;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.dragging {
    border-color: #000;
    background: #f4f4f4;
}

.drop-zone.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.drop-title {
    font-size: 17px;
    font-weight: 600;
}

.drop-desc {
    margin-top: 6px;
    font-size: 13px;
    color: #666;
}

.upload-tip {
    font-size: 13px;
    color: #666;
    margin-top: 14px;
}

.editor-card .section-header {
    margin-bottom: 16px;
}

.editor-body {
    display: flex;
    gap: 28px;
}

.preview-panel {
    flex: 0 0 360px;
    max-width: 360px;
}

.square-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid #ddd;
    background: repeating-conic-gradient(#f6f6f6 0% 25%, #fff 0% 50%) 50% / 16px 16px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

#previewCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.preview-tip {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

.editor-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label,
.control-group span {
    font-size: 14px;
    font-weight: 600;
}

.control-desc {
    font-size: 12px;
    color: #999;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="range"] {
    flex: 1;
}

.range-value {
    font-size: 13px;
    color: #333;
    min-width: 48px;
    text-align: right;
}

.bg-toggle {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(80px, 1fr));
    border: 1px solid #000;
    width: fit-content;
}

.bg-toggle input {
    display: none;
}

.bg-toggle label {
    padding: 8px 18px;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    background: #fff;
    color: #000;
    transition: background 0.2s ease, color 0.2s ease;
}

.bg-toggle input:checked + label {
    background: #000;
    color: #fff;
}

.bg-color-picker {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bg-color-picker input[type="color"] {
    width: 56px;
    height: 36px;
    border: 1px solid #ccc;
    padding-inline: 2px;
    background: #fff;
    cursor: pointer;
}

.btn-small {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.export-btn {
    width: 100%;
}

.export-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.status-text {
    font-size: 13px;
    color: #666;
}

@media (max-width: 900px) {
    .editor-body {
        flex-direction: column;
    }

    .preview-panel {
        flex: none;
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 600px) {
    .bg-toggle {
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
    }

    .export-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}
