.tw-hidden {
    display: none !important;
}

.frame-maker-container {
    text-align: center;
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
    font-family: "Montserrat", sans-serif;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .frame-maker-container {
        padding: 20px;
        width: 95%;
    }
}

.frame-maker-container h1 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #1a1a1a;
    font-size: 2rem;
    font-weight: 800;
}

.frame-maker-container p {
    margin-bottom: 25px;
    color: #666;
    font-size: 0.9rem;
}

#avatarCanvasContainer {
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 25px auto;
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 4px solid #fff;
    cursor: move;
    cursor: grab;
    background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="10" height="10" fill="%23eee" /><rect x="10" y="10" width="10" height="10" fill="%23eee" /></svg>');
}

#avatarCanvasContainer:active {
    cursor: grabbing;
}

#avatarCanvasContainer canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Controls Layout */
.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
    z-index: 30; /* Ensure controls are above other potential layers */
}

.control-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: #888;
}

/* Input with Settings Button */
.input-with-settings {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

#textInput {
    padding: 12px;
    font-family: "Montserrat", sans-serif;
    flex-grow: 1;
    min-width: 0;
    box-sizing: border-box;
    outline: none;
    text-align: center;
    border: 2px solid #e0e0e0;
    background-color: #ffffff;
    color: #000;
    border-radius: 8px;
    font-weight: 600;
    transition: border-color 0.2s;
    --active-border-color: #2a9d8f;
}

#textInput:focus {
    border-color: var(--active-border-color);
}

.settings-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    width: 46px;
    flex-shrink: 0; /* Prevent shrinking */
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.settings-btn:hover {
    background: #e0e0e0;
    color: #000;
}

/* File Upload */
input[type="file"] {
    display: none;
}

.file-upload-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px dashed #d42426;
    border-radius: 8px;
    color: #d42426;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

#zoomSlider {
    width: 100%;
    cursor: pointer;
    accent-color: #2a9d8f;
}

#downloadBtn {
    padding: 14px 24px;
    border: none;
    background: linear-gradient(45deg, #d42426, #2a9d8f);
    color: white;
    border-radius: 25px;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    transition:
        opacity 0.3s,
        transform 0.1s;
    margin-top: 5px;
    font-family: "Montserrat", sans-serif;
    width: 100%;
}

#downloadBtn:hover {
    opacity: 0.9;
}
#downloadBtn:active {
    transform: scale(0.98);
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 15px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #888;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.setting-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

/* Color Pickers inside Modal */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.color-picker-row:hover {
    background: #ededed;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    /* color-scheme: dark; */
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.color-label-text {
    font-family: monospace;
    font-size: 0.9rem;
    color: #333;
    flex-grow: 1;
}

.remove-color-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 5px;
    font-size: 1.1rem;
}
.remove-color-btn:hover {
    color: #d42426;
}

.add-color-btn {
    width: 100%;
    padding: 10px;
    border: 1px dashed #aaa;
    background: white;
    color: #555;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.add-color-btn:hover {
    border-color: #333;
    color: #333;
    background: #fafafa;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.apply-btn {
    background: #1a1a1a;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.apply-btn:hover {
    background: #333;
}

.undo-btn {
    background: #f0f0f0;
    color: #555;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.undo-btn:hover:not(:disabled) {
    background: #e0e0e0;
    color: #000;
}

.undo-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
