@font-face {
    font-family: 'Rodin';
    src: url('fonts/RodinPRO.otf') format('opentype');
}

@font-face {
    font-family: 'Yuruka';
    src: url('fonts/yuruka.ttf') format('truetype');
}

* {
    box-sizing: border-box;
}

body {
    background-image: url('assets/bg.png');
    font-family: 'Montserrat', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
    margin: 0;
    padding: 10px;
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
}

#title {
    font-family: 'Yuruka', sans-serif;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 15px;
}

.container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 280px;
    flex-shrink: 0;
}

.preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

canvas {
    border-radius: 50%;
    border: 1px dashed #ccc;
    width: 600px;
    height: 600px;
    cursor: grab;
    max-width: 100%;
    max-height: 600px;
    font-family: 'Rodin', sans-serif;
}

canvas:active {
    cursor: grabbing;
}

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

select {
    background-color: #fdfdfd;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23666' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position-x: calc(100% - 1em);
    background-position-y: center;
    padding-right: 2.5em;
}

select option {
    background-color: white;
    color: #444;
    font-family: 'Montserrat', sans-serif;
    font-size: 1em;
    padding: 10px;
}

.button-row {
    display: flex;
    gap: 10px;
}

label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

button, input[type="file"], select {
    width: 100%;
    padding: 12px;
    border-radius: 100px;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 1em;
}

button {
    font: 600 1em 'Montserrat', sans-serif;
    background-color: #78EEDD;
    color: #555577;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s;
}

button:hover {
    background-color: #68ccbd;
}

button:active {
    transform: translateY(1px);
}

#download-btn {
    background-color: #ec93b1;
}

#download-btn:hover {
    background-color: #c27f95;
}

input[type="range"] {
    padding: 0;
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 40px;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 20px;
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 20px;
}
input[type="color"]::-webkit-color-swatch {
    border: 1px solid #ccc;
    border-radius: 20px;
}


.hidden {
    display: none !important;
}

/* --- NEW STYLES FOR CUSTOM IMAGE DROPDOWN --- */
.custom-dropdown {
    position: relative;
}

.custom-dropdown .dropdown-toggle {
    width: 100%;
    padding: 8px 12px;
    border-radius: 100px;
    border: 1px solid #ccc;
    cursor: pointer;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 45px; /* Set a fixed height */
}

.custom-dropdown .selected-preview-img {
    height: 30px;
    width: 30px;
    object-fit: contain;
}

.custom-dropdown .placeholder-text {
    font-size: 1em;
    color: #555;
}

.custom-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 105%;
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    padding: 10px;
}

.dropdown-menu.visible {
    display: block;
}

.dropdown-menu .character-group {
    margin-bottom: 15px;
}

.dropdown-menu .character-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
    text-transform: capitalize;
}

.dropdown-menu .sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
}

.dropdown-menu .sticker-option {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    cursor: pointer;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: all 0.2s;
    background-color: #f9f9f9;
}

.dropdown-menu .sticker-option:hover {
    border-color: #78EEDD;
    transform: scale(1.05);
}

#textInput {
    width: 100%;
    padding: 8px 12px;
    border-radius: 100px;
    border: 1px solid #ccc;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 45px;
    font-family: 'Montserrat', sans-serif;
}

.switch-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.switch-label {
    color: #666;
    font-size: 14px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #7ed3c5;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #888;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

@media (hover: none) and (pointer: coarse) {
    button, input[type="file"], select {
        padding: 14px;
        font-size: 16px;
    }
}

@media (max-width: 1024px) {
    .container {
        gap: 20px;
        padding: 20px;
    }
    
    canvas {
        width: 350px;
        height: 350px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 5px;
        align-items: flex-start;
        background-attachment: scroll;
    }
    
    .container {
        flex-direction: column;
        align-items: center;
        padding: 15px;
        gap: 20px;
        margin: 5px 0;
    }
    
    .controls {
        width: 100%;
        max-width: 400px;
        order: 2;
    }
    
    .preview {
        order: 1;
        width: 100%;
    }
    
    canvas {
        width: 90vw;
        height: 90vw;
        max-width: 350px;
        max-height: 350px;
    }
    
    #title {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    button, input[type="file"], select {
        font-size: 16px;
        padding: 14px;
    }
    
    .button-row {
        flex-direction: row;
        gap: 8px;
    }
    
    .button-row button {
        flex: 1;
    }
}

@media (max-width: 480px) {
    body {
        padding: 2px;
    }
    
    .container {
        padding: 10px;
        gap: 15px;
    }
    
    canvas {
        width: 85vw;
        height: 85vw;
        max-width: 300px;
        max-height: 300px;
    }
    
    #title {
        font-size: 1.2rem;
    }
    
    button, input[type="file"], select {
        padding: 12px;
    }
    
    .control-group {
        gap: 6px;
    }
    
    label {
        font-size: 0.85rem;
    }
}

@media (max-width: 320px) {
    canvas {
        width: 90vw;
        height: 90vw;
        max-width: 250px;
        max-height: 250px;
    }
    
    .container {
        padding: 8px;
    }
    
    button, input[type="file"], select {
        padding: 10px;
        font-size: 14px;
    }
}