.contact-dialog {
    position: fixed;
    inset: 0;
    width: min(1080px, calc(100vw - 32px));
    max-width: none;
    max-height: min(94dvh, 760px);
    overflow-y: auto;
    margin: auto;
    padding: clamp(16px, 2.4vw, 28px);
    border: 1px solid #0101FF;
    border-radius: 12px;
    color: #101010;
    background: #fff;
    box-shadow: 0 18px 70px rgba(0, 0, 0, .2);
    opacity: 1;
    transform: scale(1);
    transform-origin: var(--contact-origin-x, 50%) var(--contact-origin-y, 50%);
    transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.contact-dialog *,
.contact-dialog {
    cursor: auto !important;
}

.contact-dialog button,
.contact-dialog a {
    cursor: pointer !important;
}

.contact-dialog::backdrop {
    background: rgba(8, 8, 24, .58);
    backdrop-filter: blur(2px);
    transition: background-color 180ms ease-out;
}

.contact-dialog.is-entering,
.contact-dialog.is-closing {
    opacity: 0;
    transform: scale(.95);
}

.contact-dialog.is-entering::backdrop,
.contact-dialog.is-closing::backdrop {
    background: transparent;
}

.contact-dialog.is-closing {
    transition-duration: 144ms;
    transition-timing-function: ease-in;
}

.contact-dialog.is-closing::backdrop {
    transition-duration: 144ms;
}

.contact-challenge-layout {
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
    align-items: start;
    gap: clamp(18px, 3vw, 32px);
}

.contact-dialog p {
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.55;
}

.contact-dialog .contact-challenge-thanks {
    margin-bottom: 8px;
}

.contact-mini-garden {
    width: min(840px, 100%);
    margin: 12px auto 0;
    padding-top: 8px;
    border-top: 1px solid #e5e5ee;
}

.contact-garden-flowers {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-auto-rows: 40px;
    align-items: center;
    justify-items: center;
    gap: 4px;
    margin-inline: auto;
}

.contact-garden-flower {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    margin: 0;
    transform: translateY(var(--flower-shift)) rotate(var(--flower-tilt));
}

.contact-garden-flower svg {
    display: block;
    width: auto;
    max-width: 100%;
    height: 40px;
    overflow: visible;
}

.contact-garden-flower [data-wind-flower] {
    transform-box: fill-box;
    transform-origin: center bottom;
}

.contact-garden-status {
    min-height: 1em;
    margin: 5px 0 0 !important;
    color: #555;
    font-size: 12px !important;
    line-height: 1.3 !important;
}

.contact-honeypots {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.contact-dialog .contact-palette-label {
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 700;
}

.contact-palette {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

.contact-color {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--contact-color);
    box-shadow: 0 0 0 1px #999;
    cursor: pointer;
    transition: transform 160ms ease-out, box-shadow 160ms ease-out;
}

.contact-color[data-color="blue"] { --contact-color: #0101FF; }
.contact-color[data-color="coral"] { --contact-color: #ff6b6b; }
.contact-color[data-color="sunshine"] { --contact-color: #ffd166; }
.contact-color[data-color="mint"] { --contact-color: #43aa8b; }

.contact-color:hover {
    transform: scale(1.05);
}

.contact-color.is-selected {
    box-shadow: 0 0 0 2px #111;
}

.contact-color:focus-visible,
.contact-dialog button:focus-visible,
.contact-canvas:focus-visible,
.contact-email-result a:focus-visible {
    outline: 3px solid #0101FF;
    outline-offset: 3px;
}

.contact-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2.65 / 1;
    border: 1px solid #b9b9c9;
    border-radius: 5px;
    background: #fff;
    touch-action: none;
    cursor: none !important;
}

.contact-canvas-wrap {
    position: relative;
    width: 100%;
}

.contact-brush-cursor {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    width: 15px;
    height: 15px;
    border: 2px solid #fff;
    border-radius: 50%;
    outline: 1px solid #0101FF;
    background: #0101FF;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.contact-brush-cursor[data-color="coral"] { background: #ff6b6b; }
.contact-brush-cursor[data-color="sunshine"] { background: #ffd166; }
.contact-brush-cursor[data-color="mint"] { background: #43aa8b; }

.contact-canvas-wrap.is-pointer-over .contact-brush-cursor {
    opacity: 1;
}

.contact-challenge-status {
    min-height: 1.25em;
    margin: 6px 0 10px !important;
    color: #333;
    font-size: 13px !important;
}

.contact-challenge-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
}

.contact-dialog button {
    font: inherit;
}

.contact-dialog .contact-clear-button,
.contact-dialog .contact-reveal-button {
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid #0101FF;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease-out, background-color 160ms ease-out, color 160ms ease-out;
}

.contact-dialog .contact-clear-button {
    color: #0101FF;
    background: #fff;
}

.contact-dialog .contact-reveal-button {
    color: #fff;
    background: #0101FF;
}

.contact-dialog .contact-clear-button:active,
.contact-dialog .contact-reveal-button:active,
.contact-color:active {
    transform: scale(.97);
}

.contact-dialog .contact-reveal-button:disabled {
    border-color: #888;
    background: #888;
    cursor: not-allowed;
}

.contact-dialog .contact-close-button {
    cursor: pointer;
}

.contact-dialog .contact-dialog-close {
    position: absolute;
    z-index: 3;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    color: #111;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.contact-dialog .contact-email-result {
    margin: 18px 0 0;
    font-size: 18px;
    font-weight: 700;
}

.contact-email-result a {
    color: #0101FF;
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .contact-challenge-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .contact-garden-flowers {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-auto-rows: 32px;
    }

    .contact-garden-flower svg {
        height: 32px;
    }

    .contact-challenge-drawing {
        grid-row: 2;
    }

    .contact-canvas {
        aspect-ratio: 2.8 / 1;
    }
}

@media (max-height: 620px) and (min-width: 761px) {
    .contact-dialog {
        padding: 14px 20px;
    }

    .contact-dialog p {
        margin-bottom: 5px;
        font-size: 13px;
        line-height: 1.35;
    }

    .contact-mini-garden {
        margin-top: 8px;
        padding-top: 6px;
    }

    .contact-garden-flowers {
        grid-auto-rows: 30px;
        gap: 3px;
    }

    .contact-garden-flower svg {
        height: 30px;
    }

    .contact-palette .contact-color {
        width: 30px;
        height: 30px;
    }

    .contact-canvas {
        aspect-ratio: 3.2 / 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .contact-dialog,
    .contact-dialog::backdrop,
    .contact-color,
    .contact-dialog button {
        transition-duration: 0.01ms;
    }
}
