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

body {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 50%, #e17055 100%);
    font-family: 'Georgia', 'Times New Roman', serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    color: #2d3436;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
    border: 2px solid rgba(45, 52, 54, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(45, 52, 54, 0.5);
}

.container {
    text-align: center;
    max-width: 1200px;
    width: 100%;
}

h1 {
    color: #2d3436;
    font-family: 'Bangers', cursive;
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #636e72;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.meme-editor {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.meme-canvas {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
    border: 3px solid rgba(253, 203, 110, 0.5);
    border-radius: 10px;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#baseImage {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    width: auto;
    pointer-events: none;
    user-select: none;
}

.text-element {
    position: absolute;
    cursor: move;
    user-select: none;
    padding: 5px 10px;
    background-color: transparent;
    border: none;
    border-radius: 5px;
    min-width: 100px;
    font-size: 24px;
    font-weight: bold;
    color: #000000;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 5px;
}

.text-element:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px dashed #fdcb6e;
}

.text-element.selected {
    border: 2px solid #fdcb6e;
    background-color: transparent;
}

.text-element.selected:hover {
    border-color: #e17055;
    background-color: transparent;
}

.text-element input {
    border: none;
    background: transparent;
    outline: none;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    color: inherit;
    width: 100%;
    min-width: 80px;
    transition: font-family 0.2s ease;
}

.text-controls {
    position: absolute;
    top: -30px;
    right: 0;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.text-element:hover .text-controls {
    opacity: 1;
}

.text-element .size-controls {
    opacity: 0;
    transition: opacity 0.2s;
}

.text-element.selected .size-controls {
    opacity: 1;
}

.font-select {
    padding: 2px 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    background-color: white;
}

.size-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 5px;
}

.size-btn {
    width: 16px;
    height: 12px;
    border: 1px solid #ccc;
    background-color: white;
    cursor: pointer;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    padding: 0;
    line-height: 1;
}

.size-btn:hover {
    background-color: #fdcb6e;
    border-color: #e17055;
}

.size-btn:active {
    background-color: #e17055;
}

.color-picker {
    width: 16px;
    height: 16px;
    border: 1px solid #ccc;
    border-radius: 2px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.delete-btn {
    background-color: #e17055;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
}

.delete-btn:hover {
    background-color: #d63031;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #2d3436;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: #ffffff;
    color: #2d3436;
}

#addTextBtn {
    background-color: #2d3436;
    color: #ffffff;
}

#addTextBtn:hover {
    background-color: #ffffff;
    color: #2d3436;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.download-btn {
    background-color: #ffffff;
    color: #2d3436;
}

.download-btn:hover {
    background-color: #fdcb6e;
    color: #2d3436;
    border-color: #e17055;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Font classes */
.text-element.font-anton,
.text-element.font-anton input {
    font-family: 'Anton', sans-serif !important;
}

.text-element.font-bangers,
.text-element.font-bangers input {
    font-family: 'Bangers', cursive !important;
}

.text-element.font-great-vibes,
.text-element.font-great-vibes input {
    font-family: 'Great Vibes', cursive !important;
}

.text-element.font-tinos,
.text-element.font-tinos input {
    font-family: 'Tinos', serif !important;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .back-button {
        top: 15px;
        left: 15px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    
    .meme-editor {
        padding: 0;
    }
    
    .text-element {
        font-size: 18px;
        min-width: 80px;
        padding: 3px 8px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .text-controls {
        gap: 8px;
    }
    
    .font-select, .color-picker, .delete-btn {
        font-size: 11px;
        padding: 2px 4px;
    }
    
    .size-btn {
        width: 14px;
        height: 10px;
        font-size: 7px;
    }
}

@media (max-width: 480px) {
    .back-button {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .meme-editor {
        padding: 0;
    }
    
    .text-element {
        font-size: 16px;
        min-width: 60px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

