.ddlx-scratch {
    --ddlx-scratch-primary: #20134a;
    --ddlx-scratch-accent: #f7c866;
    --ddlx-scratch-paper: #fcf9f3;
    --ddlx-scratch-ink: #241937;
    --ddlx-scratch-muted: #62566d;
    --ddlx-scratch-line: #e6dce6;
    position: relative;
    box-sizing: border-box;
    color: var(--ddlx-scratch-ink);
    font: 1rem/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ddlx-scratch *, .ddlx-scratch *::before, .ddlx-scratch *::after {
    box-sizing: inherit;
}

.ddlx-scratch [hidden] {
    display: none !important;
}

.ddlx-scratch :where(button, input, a):focus-visible {
    outline: 2px solid #6851a7;
    outline-offset: 3px;
}

.ddlx-scratch__panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    inline-size: min(100%, 57rem);
    margin-inline: auto;
    overflow: hidden;
    color: var(--ddlx-scratch-ink);
    background: var(--ddlx-scratch-paper);
    border: 1px solid var(--ddlx-scratch-line);
    border-radius: 1.5rem;
    box-shadow: 0 0.75rem 2.5rem rgb(36 25 55 / 10%);
    isolation: isolate;
}

.ddlx-scratch__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 0.9rem;
    min-inline-size: 0;
    padding: clamp(1.45rem, 4vw, 3.375rem);
}

.ddlx-scratch .ddlx-scratch__title {
    margin: 0;
    color: var(--ddlx-scratch-ink);
    font: 760 clamp(1.65rem, 3.4vw, 2.8rem)/1.06 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: -0.045em;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

.ddlx-scratch :is(.ddlx-scratch__description, .ddlx-scratch__privacy, .ddlx-scratch__status) {
    max-inline-size: 43ch;
    margin: 0;
    color: var(--ddlx-scratch-muted);
    overflow-wrap: anywhere;
}

.ddlx-scratch__privacy,
.ddlx-scratch__status {
    font-size: 0.875rem;
}

.ddlx-scratch a.ddlx-scratch__privacy {
    color: var(--ddlx-scratch-muted);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.ddlx-scratch__status:empty {
    margin-block-start: -0.9rem;
}

.ddlx-scratch__form, .ddlx-scratch__field {
    display: grid;
    gap: 0.65rem;
    inline-size: 100%;
}

.ddlx-scratch__field {
    gap: 0.3rem;
}

.ddlx-scratch__field span {
    font-size: 0.875rem;
    font-weight: 650;
}

.ddlx-scratch .ddlx-scratch__field input {
    inline-size: 100%;
    min-block-size: 2.75rem;
    margin: 0;
    padding: 0.55rem 0.75rem;
    color: var(--ddlx-scratch-ink);
    background: #fff;
    border: 1px solid #bfb3c2;
    border-radius: 0.6rem;
    font: inherit;
}

.ddlx-scratch__consent {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0;
    color: var(--ddlx-scratch-muted);
    font-size: 0.875rem;
}

.ddlx-scratch__consent input[type="checkbox"] {
    appearance: auto;
    flex: 0 0 auto;
    inline-size: 1rem;
    block-size: 1rem;
    margin: 0.2em 0 0;
    accent-color: #574086;
}

.ddlx-scratch :is(.ddlx-scratch__reveal, .ddlx-scratch__copy, .ddlx-scratch__launcher, .ddlx-scratch__close) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45em;
    min-block-size: 2.75rem;
    max-inline-size: 100%;
    margin: 0;
    padding: 0.6em 1em;
    color: var(--ddlx-scratch-ink);
    background: #fff;
    border: 1px solid #bfb3c2;
    border-radius: 0.65rem;
    box-shadow: none;
    cursor: pointer;
    font: 650 0.875rem/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: normal;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    overflow-wrap: anywhere;
}

.ddlx-scratch :is(.ddlx-scratch__reveal, .ddlx-scratch__copy, .ddlx-scratch__close):hover:not(:disabled) {
    color: var(--ddlx-scratch-ink);
    background: #f2ebf7;
    border-color: #8f78ad;
}

.ddlx-scratch .ddlx-scratch__reveal {
    justify-self: start;
    margin-block-start: 0.1rem;
    padding-inline: 1.05rem;
}

.ddlx-scratch .ddlx-scratch__reveal:disabled {
    cursor: default;
    opacity: 0.65;
}

.ddlx-scratch__stage {
    position: relative;
    display: grid;
    align-items: center;
    min-inline-size: 0;
    min-block-size: 17rem;
    padding: clamp(1rem, 2.65vw, 2rem);
    background-color: var(--ddlx-scratch-primary);
    background-image: radial-gradient(ellipse at 25% 12%, rgb(255 255 255 / 24%), transparent 62%),
        repeating-linear-gradient(119deg, transparent 0 33px, rgb(255 255 255 / 8%) 34px, transparent 35px 44px);
}

.ddlx-scratch__ticket {
    position: relative;
    display: grid;
    gap: 0.7rem;
    inline-size: min(100%, 26rem);
    margin-inline: auto;
    padding: clamp(0.75rem, 1.5vw, 1.15rem);
    color: var(--ddlx-scratch-ink);
    background: #fff9f2;
    border: 1px solid #fff;
    border-block-start: 0.2rem solid var(--ddlx-scratch-accent);
    border-radius: 1.25rem;
    box-shadow: 0 1rem 2.35rem rgb(10 6 26 / 32%);
}

.ddlx-scratch__ticket::before {
    position: absolute;
    inset: 0.3rem;
    border: 1px solid #ebdeea;
    border-radius: 1rem;
    content: "";
    pointer-events: none;
}

.ddlx-scratch__surface {
    position: relative;
    display: grid;
    place-items: center;
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%;
    min-block-size: 8.5rem;
    aspect-ratio: 560 / 270;
    overflow: hidden;
    padding: 0.875rem;
    background-color: #fff2ca;
    background-image: radial-gradient(ellipse at 50% 42%, #fffdf4, transparent 88%),
        repeating-linear-gradient(145deg, transparent 0 9px, rgb(115 82 11 / 5%) 10px, transparent 11px 16px);
    border: 1px solid #b8aabf;
    border-radius: 0.72rem;
}

.ddlx-scratch__surface.is-revealed {
    aspect-ratio: auto;
    border-color: #d6bb87;
}

.ddlx-scratch__canvas, .ddlx-scratch__foil-label {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
}

.ddlx-scratch__canvas {
    display: none;
    touch-action: auto;
    user-select: none;
}

.ddlx-scratch.has-scratch-canvas .ddlx-scratch__canvas {
    display: block;
}

.ddlx-scratch__surface.is-ready .ddlx-scratch__canvas {
    cursor: grab;
    touch-action: none;
}

.ddlx-scratch__surface.is-ready .ddlx-scratch__canvas:active {
    cursor: grabbing;
}

.ddlx-scratch__surface[aria-busy="true"] .ddlx-scratch__canvas {
    cursor: progress;
}

.ddlx-scratch__foil-label {
    display: grid;
    place-content: center;
    margin: 0;
    padding: 1rem;
    color: #332448;
    background: linear-gradient(115deg, #bbb0ce, #f9ecda 44%, #d2c7df 73%, #faf3ee);
    font-weight: 700;
    text-align: center;
    pointer-events: none;
}

.ddlx-scratch.has-scratch-canvas .ddlx-scratch__foil-label {
    display: none;
}

.ddlx-scratch progress.ddlx-scratch__progress {
    appearance: none;
    display: block;
    inline-size: 100%;
    block-size: 0.33rem;
    margin: 0;
    overflow: hidden;
    color: var(--ddlx-scratch-primary);
    background: #e7dce8;
    border: 0;
    border-radius: 1rem;
    accent-color: var(--ddlx-scratch-primary);
}

.ddlx-scratch__progress::-webkit-progress-bar {
    background: #e7dce8;
}

.ddlx-scratch__progress::-webkit-progress-value {
    background: var(--ddlx-scratch-primary);
    border-radius: 1rem;
}

.ddlx-scratch__progress::-moz-progress-bar {
    background: var(--ddlx-scratch-primary);
    border-radius: 1rem;
}

.ddlx-scratch__result {
    display: grid;
    gap: 0.5rem;
    justify-items: center;
    min-inline-size: 0;
    inline-size: 100%;
    color: var(--ddlx-scratch-ink);
    text-align: center;
    overflow-wrap: anywhere;
    animation: ddlx-scratch-reveal 240ms ease-out both;
}

.ddlx-scratch__result [data-scratch-prize] {
    margin: 0;
    color: inherit;
    font: 760 clamp(1.1rem, 2.3vw, 1.55rem)/1.15 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: -0.025em;
}

.ddlx-scratch__result [data-scratch-prize]:focus {
    border-radius: 0.15rem;
    outline: 2px solid #6851a7;
    outline-offset: 0.2rem;
}

.ddlx-scratch__result :is([data-scratch-message], [data-scratch-expires]) {
    margin: 0;
    color: #594d55;
    font-size: 0.84rem;
}

.ddlx-scratch__coupon {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    min-inline-size: 0;
    max-inline-size: 100%;
}

.ddlx-scratch__coupon code {
    display: block;
    min-inline-size: 0;
    max-inline-size: 100%;
    padding: 0.45rem 0.6rem;
    color: var(--ddlx-scratch-ink);
    background: #fffdf8;
    border: 1px dashed #9b7b41;
    border-radius: 0.4rem;
    font: 650 0.875rem/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
    overflow-wrap: anywhere;
    user-select: all;
}

.ddlx-scratch .ddlx-scratch__copy {
    padding-inline: 0.75em;
}

.ddlx-scratch .ddlx-scratch__launcher {
    position: fixed;
    z-index: 1000;
    inset-inline-end: max(1rem, env(safe-area-inset-right));
    inset-block-end: max(1rem, env(safe-area-inset-bottom));
    max-inline-size: calc(100% - 2rem);
    padding: 0.65rem 1rem;
    color: #201631;
    background: #f7c866;
    background: color-mix(in srgb, var(--ddlx-scratch-accent) 35%, white);
    border-color: #201631;
    border-radius: 2rem;
    box-shadow: 0 0.45rem 1.5rem rgb(25 19 46 / 23%);
}

.ddlx-scratch .ddlx-scratch__launcher:hover {
    color: #201631;
    background: color-mix(in srgb, var(--ddlx-scratch-accent) 45%, white);
}

.ddlx-scratch .ddlx-scratch__dialog {
    position: fixed;
    z-index: 1001;
    inset: 0;
    display: none;
    inline-size: min(calc(100% - 2rem), 57rem);
    max-inline-size: none;
    max-block-size: calc(100% - 2rem);
    max-block-size: calc(100dvh - 2rem);
    margin: auto;
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
    color: inherit;
    background: var(--ddlx-scratch-paper);
    border: 0;
    border-radius: 1.5rem;
    box-shadow: 0 1rem 5rem rgb(20 13 35 / 37%);
}

.ddlx-scratch .ddlx-scratch__dialog[open] {
    display: block;
}

.ddlx-scratch__dialog::backdrop {
    background: rgb(20 13 35 / 67%);
}

html:has(.ddlx-scratch__dialog[open]) {
    overflow: hidden;
}

.ddlx-scratch__dialog .ddlx-scratch__panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.ddlx-scratch .ddlx-scratch__close {
    position: absolute;
    z-index: 1;
    inset: 0.7rem 0.7rem auto auto;
    inline-size: 2.75rem;
    padding: 0;
    border-radius: 50%;
    font-size: 1.45rem;
    line-height: 1;
}

@keyframes ddlx-scratch-reveal {
    from { opacity: 0; transform: translateY(0.25rem); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 700px) {
    .ddlx-scratch__panel {
        grid-template-columns: minmax(0, 1fr);
        border-radius: 1.12rem;
    }

    .ddlx-scratch__stage {
        min-block-size: 0;
    }

    .ddlx-scratch__dialog .ddlx-scratch__content {
        padding-block-start: 3.65rem;
    }

    .ddlx-scratch .ddlx-scratch__dialog {
        border-radius: 1.12rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ddlx-scratch__result {
        animation: none;
    }
}
