
/* #region APP ----------------------------- */

* {
    box-sizing: border-box;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    width: min(700px, 100%);
    padding: 20px;
    background: white;
    border-radius: 22px;
    box-shadow: 0 12px 40px #0000000d;
    text-align: center;
}

body {
    margin: 0;
    background: #f3f3f3;
    color: #171717;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1 {
    font-size: clamp(28px, 5vw, 44px);
    line-height: 1.1;
    margin: 0 0 18px;
}

p {
    line-height: 1.4;
}

.text-left {
    text-align: left;
}

/* #endregion */
/* #region MEDIA --------------------------- */

@media (max-width: 700px) {
    .card {
        padding: 22px 16px;
    }

    .page {
        padding: 10px;
    }

    /* Formularfelder untereinander */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group {
        width: 100%;
        box-sizing: border-box;
    }
}

/* #endregion */
/* #region FORM ---------------------------- */

form {
    text-align: left;
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

form .button {
    width: 100%;
}

.form-group {
    flex: 1;
    margin-bottom: 10px;
    min-width: 0;
}

.form-group input,
.form-group select {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    padding: 10px 12px;
    font: inherit;
}

.form-group input[type="datetime-local"] {
    display: block;
    min-width: 0;
    width: 100%;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    height: 44px;
    max-height: 44px;
}

.form-group input[type="datetime-local"]::-webkit-date-and-time-value {
    text-align: left;
}

.form-row {
    display: flex;
    gap: 16px;
}

#formStatus {
    overflow-wrap: anywhere;
}

/* #endregion */
/* #region GALLERY ------------------------- */

.top-gallery {
    display: flex;
    flex-direction: row;
    gap: 10px;
    height: 150px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 10px;
    box-sizing: border-box;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.top-gallery-item {
    flex: 0 0 130px;
    height: 130px;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    scroll-snap-align: start;
}

.top-gallery-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.top-gallery-item.selected {
    border-color: #333;
}

.top-gallery-item:focus-visible {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* #endregion */
/* #region INPUT --------------------------- */

input,
select {
    height: 44px;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font: inherit;
    background: white;
}

input[type=file] {
    padding: 10px;
}

/* #endregion */
/* #region SCRATCH ------------------------- */

.scratch-wrap {
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 22px;
}

.scratch-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    z-index: 0;
}

#scratchCanvas {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    cursor: pointer;
}

.scratch-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffffdd;
}

/* #endregion */
/* #region RESULT -------------------------- */

.result-image {
    display: block;
    width: 100%;
    max-width: 650px;
    height: auto;
    margin: 20px auto;
    border-radius: 15px;
}

.result-buttons {
    display: grid;
    gap: 12px;
    width: 100%;
    margin-top: 20px;
}

.result-buttons.columns-1 {
    grid-template-columns: 1fr;
}

.result-buttons.columns-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-buttons.columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-buttons.columns-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-buttons .button {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 12px 4px;
    text-align: center;
    white-space: nowrap;
}

#result {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* #endregion */
/* #region REST ---------------------------- */

.already-used-notice {
    margin-top: 16px;
    font-size: 14px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 12px;
}

label {
    display: grid;
    gap: 7px;
    font-size: 14px;
    font-weight: 600;
}

.button {
    display: inline-block;
    background: #151515;
    color: white;
    border: 0;
    border-radius: 11px;
    padding: 13px 20px;
    text-decoration: none;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
    text-align: center;
}

.hidden {
    display: none !important;
}

.upload-preview {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 12px;
    background: white;
}

#giftUrl {
    margin-bottom: 10px;
}

/* #endregion */
