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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

h1 {
    font-size: 1.8rem;
    font-weight: 500;
    color: #ffffff;
    text-align: center;
}

.preview-container {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    background-color: #252525;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#preview {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px;
}

.control-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.9rem;
    color: #b0b0b0;
}

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a9eff;
    cursor: pointer;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #6bb3ff;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a9eff;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #6bb3ff;
}

#export-btn {
    padding: 12px 24px;
    background-color: #4a9eff;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

#export-btn:hover {
    background-color: #6bb3ff;
}

#export-btn:active {
    background-color: #3a8eef;
}

.dimensions-info {
    text-align: center;
    color: #707070;
    font-size: 0.85rem;
}

.dimensions-info .note {
    margin-top: 5px;
    font-size: 0.75rem;
    color: #555555;
}

/* Header with menu button */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
}

.header h1 {
    margin: 0;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #808080;
    border-radius: 1px;
    transition: background-color 0.2s;
}

.menu-btn:hover span {
    background-color: #a0a0a0;
}

/* Sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 100;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 85vw;
    height: 100%;
    background-color: #222222;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 101;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.sidebar-overlay.open .sidebar {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #808080;
    font-size: 24px;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #a0a0a0;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

/* Accordion */
.accordion {
    border-bottom: 1px solid #3a3a3a;
}

.accordion-header {
    width: 100%;
    background: none;
    border: none;
    padding: 15px 0;
    text-align: left;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-header:hover {
    color: #ffffff;
}

.accordion-icon {
    font-size: 12px;
    transition: transform 0.2s;
}

.accordion.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion.open .accordion-content {
    max-height: 500px;
}

.accordion-content p {
    padding: 0 0 15px 0;
    color: #a0a0a0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #3a3a3a;
    text-align: center;
    color: #707070;
    font-size: 0.8rem;
}

.sidebar-footer .kofi-container {
    margin-bottom: 15px;
}

.sidebar-footer .note {
    margin-top: 5px;
    font-size: 0.7rem;
    color: #555555;
}

/* Download Success Popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.popup-overlay.open {
    opacity: 1;
    visibility: visible;
}

.popup {
    background-color: #252525;
    border-radius: 12px;
    padding: 30px;
    max-width: 360px;
    width: 100%;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.popup-overlay.open .popup {
    transform: scale(1);
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #808080;
    font-size: 24px;
    line-height: 1;
    transition: color 0.2s;
}

.popup-close:hover {
    color: #a0a0a0;
}

.popup-content {
    text-align: center;
}

.popup-emoji {
    font-size: 48px;
    margin-bottom: 15px;
}

.popup-content h2 {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.popup-content p {
    color: #a0a0a0;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.popup .kofi-container {
    display: flex;
    justify-content: center;
}

@media (max-width: 480px) {
    body {
        padding: 0;
        align-items: stretch;
    }

    .container {
        height: 100vh;
        max-width: none;
        gap: 15px;
        padding: 15px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    }

    .header {
        max-width: none;
        flex-shrink: 0;
    }

    h1 {
        font-size: 1.4rem;
    }

    .preview-container {
        flex: 1;
        min-height: 0;
        aspect-ratio: auto;
        max-width: none;
        padding: 10px;
    }

    #preview {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .controls {
        flex-direction: column;
        flex-shrink: 0;
        gap: 15px;
        max-width: none;
        margin-bottom: 5px;
    }

    .control-group {
        width: 100%;
    }

    #export-btn {
        width: 100%;
    }
}
