* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: #f2f2f2;
    color: #222;
}

.app {
    width: min(850px, 95vw);
    margin: 40px auto;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
}

h1 {
    margin: 0 0 8px;
}

.subtitle {
    margin-top: 0;
    color: #666;
}

.controls {
    margin: 0;
    margin-bottom: 10px;
}

#image-input {
    display: none;
}

.upload-button {
    display: inline-block;
    background: #333;
    color: white;
    cursor: pointer;
    border-radius: 6px;
    padding: 10px 18px;
    width: 180px;
    justify-content: center;
}

.upload-button:hover {
    background: #555;
}

.editor-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    margin-top: 25px;
}


.editor {
    flex: 0 0 512px;
    margin-top: 0;
}

#crop-container {
    position: relative;
    margin: auto;
    overflow: hidden;
    background: #ddd;
    touch-action: none;
    user-select: none;
    width: 512px;
    height: 512px;
    max-width: 100%;
    max-height: 80vh;
}

#user-image {
    position: absolute;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    user-select: none;
    pointer-events: none;
    top: 0;
    left: 0;
    z-index: 1;
}

#background-image {
    display: inline;
    position: absolute;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    top: 0;
    left: 0;
    z-index: 2;
    width: 512px;
    height: 512px;
}

#top-overlay {
    position: absolute;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    top: 0;
    left: 0;
    z-index: 3;
    width: 512px;
    height: 512px;
}

.hint {
    margin: 10px 0 0;
    color: #777;
    font-size: 14px;
}

.zoom-control {
    width: 100%;
    max-width: 512px;
    margin: 25px auto 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.zoom-control label {
    white-space: nowrap;
}

#zoom-slider {
    flex: 1;
}

.selection-controls {
    width: 200px;
    justify-content: center;
}

.selection-section {
    margin: 0 10px 20px 10px;
}

.selection-section h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.selection-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 100%;
}

.selection-option {
    position: relative;
    aspect-ratio: 1;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 8px;
    background: #eee;
    cursor: pointer;
    overflow: hidden;
}

.selection-option img {
    display: block;
    object-fit: contain;
    width: 100%;
    height: 100%;
}

.selection-option:hover {
    border-color: #aaa;
}

.selection-option.selected {
    border-color: #333;
}

.button-options {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.choice-button {
    padding: 10px 15px;
    border: 2px solid #ccc;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 15px;
    cursor: pointer;
}

.choice-button:hover {
    border-color: #999;
}

.choice-button.selected {
    border-color: #333;
    background: #333;
    color: white;
}


.download-section {
    margin-top: 30px;
}

#download-button {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    background: #333;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

#download-button:hover:not(:disabled) {
    background: #555;
}

#download-button:disabled {
    background: #aaa;

    cursor: not-allowed;
}
