.cookie-consent[hidden] {
    display: none !important;
}

.cookie-consent {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 1000;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.cookie-consent__panel {
    width: min(100%, 72rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1rem 1.1rem;
    border: var(--border-width) solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1rem 3rem rgba(23, 32, 51, 0.18);
    pointer-events: auto;
}

.cookie-consent__copy strong {
    display: block;
    color: var(--text);
    font-size: 0.96rem;
}

.cookie-consent__copy p {
    max-width: 54rem;
    margin: 0.25rem 0 0;
    color: var(--text-medium);
    font-size: 0.8rem;
    line-height: 1.5;
}

.cookie-consent__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.cookie-consent__actions .button {
    min-height: 2.65rem;
    white-space: nowrap;
}

.cookie-preferences {
    width: min(calc(100% - 2rem), 45rem);
    max-height: min(90dvh, 48rem);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    overflow: visible;
}

.cookie-preferences::backdrop {
    background: rgba(17, 24, 39, 0.62);
    backdrop-filter: blur(0.15rem);
}

.cookie-preferences__panel {
    max-height: min(90dvh, 48rem);
    overflow: auto;
    padding: clamp(1.15rem, 3vw, 1.75rem);
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1.5rem 4rem rgba(17, 24, 39, 0.22);
}

.cookie-preferences__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
}

.cookie-preferences__kicker {
    margin: 0;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.cookie-preferences__header h2 {
    margin: 0.25rem 0 0;
    font-size: clamp(1.6rem, 4vw, 2.25rem);
}

.cookie-preferences__header p:last-child {
    margin: 0.55rem 0 0;
    color: var(--text-medium);
    font-size: 0.86rem;
}

.cookie-preferences__close {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface-soft);
    color: var(--text);
    font: inherit;
    font-size: 1.4rem;
    cursor: pointer;
}

.cookie-preferences__list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.4rem;
}

.cookie-preferences__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-subtle);
}

.cookie-preferences__item strong,
.cookie-preferences__item span {
    display: block;
}

.cookie-preferences__item > div > span {
    max-width: 34rem;
    margin-top: 0.2rem;
    color: var(--text-medium);
    font-size: 0.78rem;
    line-height: 1.5;
}

.cookie-switch {
    position: relative;
    display: grid;
    grid-template-columns: auto auto;
    gap: 0.55rem;
    align-items: center;
    cursor: pointer;
}

.cookie-switch__label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.cookie-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cookie-switch__control {
    position: relative;
    width: 2.8rem;
    height: 1.55rem;
    border: var(--border-width) solid var(--line-strong);
    border-radius: var(--radius-pill);
    background: var(--surface-deep);
    transition: background 140ms ease, border-color 140ms ease;
}

.cookie-switch__control::after {
    content: "";
    position: absolute;
    top: 0.18rem;
    left: 0.18rem;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 0.1rem 0.25rem rgba(23, 32, 51, 0.22);
    transition: transform 140ms ease;
}

.cookie-switch input:checked + .cookie-switch__control {
    border-color: var(--accent);
    background: var(--accent);
}

.cookie-switch input:checked + .cookie-switch__control::after {
    transform: translateX(1.22rem);
}

.cookie-switch input:focus-visible + .cookie-switch__control {
    box-shadow: 0 0 0 0.18rem color-mix(in srgb, var(--accent) 13%, transparent);
}

.cookie-switch--locked {
    cursor: default;
}

.cookie-switch--locked .cookie-switch__control {
    opacity: 0.72;
}

.cookie-preferences__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: var(--border-width) solid var(--line);
}

.footer-cookie-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    cursor: pointer;
}

.footer-cookie-button:hover,
.footer-cookie-button:focus-visible {
    color: var(--accent-strong);
    text-decoration: underline;
}

@media (max-width: 48rem) {
    .cookie-consent__panel {
        grid-template-columns: 1fr;
    }

    .cookie-consent__actions {
        justify-content: flex-start;
    }
}

@media (max-width: 34rem) {
    .cookie-consent {
        inset-inline: 0.65rem;
        bottom: 0.65rem;
    }

    .cookie-consent__actions,
    .cookie-preferences__footer {
        display: grid;
        grid-template-columns: 1fr;
    }

    .cookie-consent__actions .button,
    .cookie-preferences__footer .button {
        width: 100%;
    }

    .cookie-preferences__item {
        grid-template-columns: 1fr;
    }

    .cookie-switch {
        justify-self: start;
    }
}
