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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffb6c1;
    background-image: 
        linear-gradient(45deg, transparent 25%, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.1) 50%, transparent 50%, transparent 75%, rgba(255,255,255,0.1) 75%),
        url('화면 캡처 2025-09-08 030952.jpg');
    background-size: 160px 160px, contain;
    background-position: 0 0, center;
    background-repeat: repeat, repeat;
    background-attachment: fixed;
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-btn {
    position: fixed;
    left: 20px;
    top: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.home-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.title-image {
    max-width: 100%;
    height: auto;
    max-height: 144px;
    margin-bottom: 10px;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    align-items: start;
}

.canvas-container {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
}

#pfpCanvas {
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    cursor: crosshair;
    background: #f8f9fa;
    max-width: 100%;
    height: auto;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    transition: opacity 0.3s ease;
}

.canvas-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.upload-prompt {
    text-align: center;
    padding: 40px;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-prompt p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #666;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.controls-panel {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    height: fit-content;
}

.control-section {
    margin-bottom: 30px;
}

.control-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.control-section input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.control-section input[type="file"]:hover {
    border-color: #667eea;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 5px;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.sticker-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom scrollbar for sticker palette */
.sticker-palette::-webkit-scrollbar {
    width: 6px;
}

.sticker-palette::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sticker-palette::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.sticker-palette::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

.sticker-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s ease;
    user-select: none;
}

.sticker-item:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: scale(1.1);
}

.sticker-item.selected {
    background: #667eea;
    color: white;
    border-color: #5a6fd8;
}

/* Sticker on canvas */
.sticker-on-canvas {
    position: absolute;
    font-size: 2rem;
    cursor: move;
    user-select: none;
    z-index: 10;
    transition: transform 0.1s ease;
}

.sticker-on-canvas:hover {
    transform: scale(1.1);
}

.sticker-on-canvas.selected {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .controls-panel {
        order: -1;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    #pfpCanvas {
        width: 100%;
        max-width: 350px;
        height: auto;
    }
}

/* Sticker Image Styles */
.sticker-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Canvas cursor styles */
#pfpCanvas {
    cursor: default;
}

#pfpCanvas.resizing {
    cursor: ew-resize;
}

#pfpCanvas.rotating {
    cursor: grab;
}

#pfpCanvas.rotating:active {
    cursor: grabbing;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
