.cookie-consent[hidden],
.cookie-preferences:not([open]) {
	display: none;
}

.cookie-consent {
	position: fixed;
	inset-inline: max(16px, env(safe-area-inset-left))
		max(16px, env(safe-area-inset-right));
	bottom: max(16px, env(safe-area-inset-bottom));
	z-index: 9970;
	max-width: 1180px;
	margin-inline: auto;
	padding: 18px;
	color: #e6e6e6;
	background:
		linear-gradient(105deg, rgba(7, 25, 87, 0.97), rgba(31, 20, 86, 0.97)),
		url("assets/brand-ribbon.svg") center / cover no-repeat;
	border: 1px solid rgba(176, 137, 242, 0.42);
	border-radius: 18px;
	box-shadow: 0 24px 70px rgba(7, 25, 87, 0.38);
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
}

.cookie-consent-inner {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 16px;
}

.cookie-consent-icon {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	color: #b089f2;
	background: rgba(176, 137, 242, 0.12);
	border: 1px solid rgba(176, 137, 242, 0.28);
	border-radius: 12px;
}

.cookie-consent-icon svg {
	width: 21px;
	height: 21px;
}
.cookie-consent-copy {
	min-width: 0;
}
.cookie-consent-title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}
.cookie-consent-text {
	margin-top: 4px;
	color: rgba(230, 230, 230, 0.78);
	font-size: 13px;
	line-height: 1.55;
}
.cookie-policy-link {
	color: #b089f2;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.cookie-policy-link:hover {
	color: #e6e6e6;
}

.cookie-consent-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}
.cookie-button,
.cookie-text-button,
.cookie-manage {
	min-height: 44px;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}
.cookie-button {
	padding: 0 16px;
	color: #e6e6e6;
	background: rgba(230, 230, 230, 0.08);
	border: 1px solid rgba(230, 230, 230, 0.24);
	border-radius: 10px;
}
.cookie-button:hover {
	background: rgba(230, 230, 230, 0.14);
}
.cookie-button-primary {
	background: #4a1fa8;
	border-color: #b089f2;
}
.cookie-button-primary:hover {
	background: #5a2cba;
}
.cookie-text-button {
	padding: 0 8px;
	color: #b089f2;
	background: transparent;
	border: 0;
}
.cookie-text-button:hover {
	color: #e6e6e6;
}

.cookie-preferences {
	width: min(560px, calc(100vw - 32px));
	max-height: min(680px, calc(100dvh - 32px));
	margin: auto;
	padding: 0;
	color: #071957;
	background: #f8f8fa;
	border: 1px solid rgba(7, 25, 87, 0.18);
	border-radius: 18px;
	box-shadow: 0 30px 100px rgba(7, 25, 87, 0.32);
}
.cookie-preferences::backdrop {
	background: rgba(7, 25, 87, 0.72);
	backdrop-filter: blur(8px);
}
.cookie-preferences-form {
	display: grid;
	gap: 0;
}
.cookie-preferences-head,
.cookie-preferences-body,
.cookie-preferences-foot {
	padding: 22px;
}
.cookie-preferences-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	border-bottom: 1px solid rgba(7, 25, 87, 0.12);
}
.cookie-preferences-head h2 {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
}
.cookie-preferences-head p {
	margin-top: 6px;
	color: #4d4a78;
	font-size: 13px;
	line-height: 1.55;
}
.cookie-dialog-close {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	color: #071957;
	background: #fff;
	border: 1px solid rgba(7, 25, 87, 0.14);
	border-radius: 10px;
	cursor: pointer;
}
.cookie-dialog-close svg {
	width: 19px;
	height: 19px;
}
.cookie-preferences-body {
	display: grid;
	gap: 12px;
}
.cookie-option {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 16px;
	align-items: center;
	padding: 16px;
	background: #fff;
	border: 1px solid rgba(7, 25, 87, 0.12);
	border-radius: 12px;
}
.cookie-option b {
	display: block;
	font-size: 14px;
}
.cookie-option p {
	margin-top: 3px;
	color: #4d4a78;
	font-size: 12.5px;
	line-height: 1.5;
}
.cookie-option-state {
	color: #4a1fa8;
	font-size: 12px;
	font-weight: 700;
}
.cookie-switch {
	position: relative;
	width: 48px;
	height: 28px;
}
.cookie-switch input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.cookie-switch-track {
	display: block;
	width: 48px;
	height: 28px;
	background: #e6e6e6;
	border: 1px solid rgba(7, 25, 87, 0.22);
	border-radius: 999px;
	cursor: pointer;
	transition:
		background 0.2s,
		border-color 0.2s;
}
.cookie-switch-track::after {
	content: "";
	display: block;
	width: 20px;
	height: 20px;
	margin: 3px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(7, 25, 87, 0.24);
	transition: transform 0.2s;
}
.cookie-switch input:checked + .cookie-switch-track {
	background: #4a1fa8;
	border-color: #4a1fa8;
}
.cookie-switch input:focus-visible + .cookie-switch-track {
	outline: 3px solid #b089f2;
	outline-offset: 3px;
}
.cookie-switch input:checked + .cookie-switch-track::after {
	transform: translateX(20px);
}
[dir="rtl"] .cookie-switch input:checked + .cookie-switch-track::after {
	transform: translateX(-20px);
}
.cookie-preferences-foot {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	border-top: 1px solid rgba(7, 25, 87, 0.12);
}
.cookie-preferences .cookie-button {
	color: #071957;
	background: #fff;
	border-color: rgba(7, 25, 87, 0.18);
}
.cookie-preferences .cookie-button-primary {
	color: #fff;
	background: #4a1fa8;
	border-color: #4a1fa8;
}
.cookie-manage {
	padding: 0;
	color: inherit;
	background: transparent;
	border: 0;
	text-decoration: underline;
	text-underline-offset: 3px;
}

:is(
		.cookie-button,
		.cookie-text-button,
		.cookie-dialog-close,
		.cookie-switch input,
		.cookie-manage,
		.cookie-policy-link
	):focus-visible {
	outline: 3px solid #b089f2;
	outline-offset: 3px;
}

@media (max-width: 860px) {
	.cookie-consent {
		padding: 16px;
	}
	.cookie-consent-inner {
		grid-template-columns: auto minmax(0, 1fr);
	}
	.cookie-consent-actions {
		grid-column: 1 / -1;
		display: grid;
		grid-template-columns: 1fr 1fr;
	}
	.cookie-text-button {
		grid-column: 1 / -1;
		grid-row: 2;
	}
}

@media (max-width: 520px) {
	.cookie-consent {
		inset-inline: 10px;
		bottom: max(10px, env(safe-area-inset-bottom));
		border-radius: 16px;
	}
	.cookie-consent-icon {
		display: none;
	}
	.cookie-consent-inner {
		grid-template-columns: 1fr;
		gap: 12px;
	}
	.cookie-consent-actions {
		grid-column: 1;
	}
	.cookie-preferences-head,
	.cookie-preferences-body,
	.cookie-preferences-foot {
		padding: 18px;
	}
	.cookie-preferences-foot {
		display: grid;
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cookie-switch-track,
	.cookie-switch-track::after {
		transition: none;
	}
}
