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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #FFE5EC 0%, #FFF 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

#app {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #FF6B9D 0%, #FFB6C1 100%);
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(255, 107, 157, 0.3);
}

.header h1 {
    font-size: 2.5em;
    color: white;
    margin-bottom: 10px;
    font-weight: 800;
}

.tagline {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.1em;
}

.main-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.upload-section {
    grid-column: 1 / -1;
}

.drop-zone {
    background: white;
    border: 3px dashed #FF6B9D;
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover {
    border-color: #FF1493;
    background: #FFF5F8;
    transform: translateY(-2px);
}

.drop-zone.dragover {
    background: #FFE5EC;
    border-color: #FF1493;
    transform: scale(1.02);
}

.drop-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.drop-text {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.drop-hint {
    color: #666;
    font-size: 0.9em;
}

.photo-strip {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.photo-count {
    color: #FF6B9D;
    font-weight: 600;
    margin-bottom: 15px;
}

.thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
}

.thumbnail {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: move;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.thumbnail:hover {
    transform: scale(1.05);
}

.thumbnail.dragging {
    opacity: 0.5;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 20, 147, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #FF1493;
    transform: scale(1.1);
}

.layout-section,
.controls-section,
.download-section {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

h3 {
    color: #FF6B9D;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.layout-btn {
    background: #FFF5F8;
    border: 2px solid #FFE5EC;
    border-radius: 12px;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.layout-btn:hover {
    border-color: #FF6B9D;
    transform: translateY(-2px);
}

.layout-btn.active {
    background: #FF6B9D;
    border-color: #FF6B9D;
    color: white;
}

.layout-preview {
    font-size: 1.5em;
    margin-bottom: 8px;
    font-family: monospace;
}

.layout-name {
    font-size: 0.85em;
    font-weight: 500;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

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

.control label {
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

.control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #FFE5EC;
    outline: none;
    -webkit-appearance: none;
}

.control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FF6B9D;
    cursor: pointer;
}

.control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FF6B9D;
    cursor: pointer;
    border: none;
}

.control input[type="color"] {
    width: 100%;
    height: 40px;
    border: 2px solid #FFE5EC;
    border-radius: 8px;
    cursor: pointer;
}

.control select {
    width: 100%;
    padding: 10px;
    border: 2px solid #FFE5EC;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 0.95em;
}

.download-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.format-toggle {
    display: flex;
    gap: 10px;
}

.format-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #FFE5EC;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.format-btn:hover {
    border-color: #FF6B9D;
}

.format-btn.active {
    background: #FF6B9D;
    color: white;
    border-color: #FF6B9D;
}

.file-info {
    color: #666;
    font-size: 0.9em;
    text-align: center;
}

.download-btn {
    background: linear-gradient(135deg, #FF6B9D 0%, #FF1493 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.5);
}

.download-btn:active {
    transform: translateY(0);
}

.canvas-preview {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    grid-column: 1 / -1;
}

#collage-canvas {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.footer {
    text-align: center;
    padding: 30px;
    color: #666;
}

.footer a {
    color: #FF6B9D;
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

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

.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    font-weight: 600;
}

.message-success {
    border-left: 4px solid #4CAF50;
    color: #2E7D32;
}

.message-error {
    border-left: 4px solid #FF6B9D;
    color: #C2185B;
}

.message.fade-out {
    animation: fadeOut 0.3s ease;
    opacity: 0;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.strawberry-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.strawberry {
    position: absolute;
    animation: berry-fall 5s linear forwards;
}

@keyframes berry-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .main-container {
        grid-template-columns: 1fr;
    }

    .layout-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .canvas-preview {
        padding: 15px;
    }

    .message-container {
        left: 20px;
        right: 20px;
    }
}