* {
    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, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

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

.container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(67, 142, 219, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(230, 0, 18, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(0, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.header {
    text-align: center;
    padding: 40px 0;
    position: relative;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #438EDB, #00FFFF, #438EDB);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(67, 142, 219, 0.3);
}

@keyframes shimmer {
    to {
        background-position: 200% center;
    }
}

.subtitle {
    font-size: 1.1rem;
    color: #888;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.upload-section {
    width: 100%;
}

.upload-area {
    border: 2px dashed rgba(67, 142, 219, 0.5);
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(67, 142, 219, 0.05);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(67, 142, 219, 0.1), transparent);
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    to {
        transform: rotate(360deg);
    }
}

.upload-area:hover {
    border-color: #438EDB;
    background: rgba(67, 142, 219, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(67, 142, 219, 0.2);
}

.upload-icon {
    color: #438EDB;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.upload-text {
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.upload-hint {
    font-size: 0.9rem;
    color: #666;
    position: relative;
    z-index: 1;
}

.editor-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(67, 142, 219, 0.2);
    backdrop-filter: blur(10px);
}

.preview-box {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(67, 142, 219, 0.1);
    position: relative;
    overflow: hidden;
}

.preview-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(67, 142, 219, 0.1), transparent);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    to {
        left: 100%;
    }
}

#previewCanvas {
    max-width: 100%;
    max-height: 380px;
    object-fit: contain;
}

.preview-info {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: rgba(67, 142, 219, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(67, 142, 219, 0.2);
}

.info-text {
    font-size: 0.9rem;
    color: #aaa;
}

.info-text span {
    color: #438EDB;
    font-weight: 600;
}

.controls-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.control-group {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(67, 142, 219, 0.2);
    backdrop-filter: blur(10px);
}

.control-title {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, #438EDB, #00FFFF);
    border-radius: 2px;
}

.color-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.color-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.color-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.color-btn:hover::before {
    opacity: 1;
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(67, 142, 219, 0.4);
}

.color-btn.active {
    border-color: #438EDB;
    box-shadow: 0 0 20px rgba(67, 142, 219, 0.5);
}

.color-btn.blue {
    background: linear-gradient(135deg, #438EDB, #2E7BB8);
}

.color-btn.red {
    background: linear-gradient(135deg, #E60012, #C40010);
}

.color-btn.white {
    background: linear-gradient(135deg, #FFFFFF, #E0E0E0);
}

.color-btn.gray {
    background: linear-gradient(135deg, #808080, #606060);
}

.color-btn.custom {
    background: linear-gradient(135deg, #1a1a2e, #0a0a0a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #438EDB;
}

.tolerance-control {
    margin-top: 20px;
    padding: 15px;
    background: rgba(67, 142, 219, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(67, 142, 219, 0.1);
}

.tolerance-label {
    display: block;
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 10px;
}

.tolerance-label span {
    color: #438EDB;
    font-weight: 600;
}

.tolerance-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(67, 142, 219, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.tolerance-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #438EDB, #00FFFF);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(67, 142, 219, 0.5);
    transition: transform 0.2s ease;
}

.tolerance-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.tolerance-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #438EDB, #00FFFF);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(67, 142, 219, 0.5);
    transition: transform 0.2s ease;
}

.tolerance-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

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

.size-btn {
    padding: 12px 20px;
    background: rgba(67, 142, 219, 0.1);
    border: 1px solid rgba(67, 142, 219, 0.3);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.size-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(67, 142, 219, 0.2), transparent);
    transition: left 0.5s ease;
}

.size-btn:hover::before {
    left: 100%;
}

.size-btn:hover {
    background: rgba(67, 142, 219, 0.2);
    border-color: #438EDB;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(67, 142, 219, 0.3);
}

.size-btn.active {
    background: linear-gradient(135deg, #438EDB, #2E7BB8);
    border-color: #438EDB;
    box-shadow: 0 5px 20px rgba(67, 142, 219, 0.4);
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.action-btn {
    flex: 1;
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-btn.reset {
    background: rgba(230, 0, 18, 0.1);
    color: #E60012;
    border: 1px solid rgba(230, 0, 18, 0.3);
}

.action-btn.reset:hover {
    background: rgba(230, 0, 18, 0.2);
    box-shadow: 0 5px 20px rgba(230, 0, 18, 0.3);
}

.action-btn.download {
    background: linear-gradient(135deg, #438EDB, #00FFFF);
    color: #000;
    border: none;
}

.action-btn.download:hover {
    box-shadow: 0 5px 30px rgba(67, 142, 219, 0.5);
}

.footer {
    text-align: center;
    padding: 30px 0;
    color: #666;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .editor-section {
        grid-template-columns: 1fr;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .color-options {
        justify-content: center;
    }
    
    .size-options {
        justify-content: center;
    }
}
