.overlay {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	overflow: hidden;
}

.overlay:focus-visible {
	outline: 0;
}

.overlay::backdrop {
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.2s;
}

.overlay.open::backdrop {
	opacity: 1;
}

.drawer {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(480px, 100%);
	background: var(--surface);
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
	padding-top: env(safe-area-inset-top, 0);
}

.overlay.open .drawer {
	transform: none;
}

.drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px 0;
}

.drawer-body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 14px 20px 20px;
	display: flex;
	flex-direction: column;
	gap: 22px;
}

.drawer-url {
	font: 600 18px/1.35 var(--font-body);
	overflow-wrap: anywhere;
}

.drawer-foot {
	padding: 14px 20px calc(16px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--line);
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--surface);
}

.overlay-modal[open] {
	display: grid;
	place-items: center;
	padding: 16px;
}

.modal {
	width: min(540px, 100%);
	max-height: 100%;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--surface);
	border-radius: 8px;
	box-shadow: var(--shadow);
	padding: clamp(20px, 4vw, 28px);
	display: flex;
	flex-direction: column;
	gap: 20px;
	opacity: 0;
	transform: translateY(8px) scale(0.985);
	transition:
		opacity 0.18s,
		transform 0.18s;
}

.overlay.open .modal {
	opacity: 1;
	transform: none;
}

.modal h2 {
	font: 600 20px/1.3 var(--font-body);
}

.opts {
	display: flex;
	flex-direction: column;
	gap: 8px;
	border: 0;
	padding: 0;
	margin: 0;
}

.opt {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 12px;
	align-items: start;
	padding: 12px 14px;
	border: 1px solid var(--line-strong);
	border-radius: 4px;
	cursor: pointer;
	transition:
		border-color 0.15s,
		background 0.15s;
}

.opt:has(input:checked) {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.opt input {
	width: 18px;
	height: 18px;
	margin: 3px 0 0;
	accent-color: var(--accent);
}

.opt b {
	display: block;
}

.opt span {
	color: var(--muted);
	font-size: 14px;
}

.modal-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
}

.done-mark {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--ok-soft);
	color: var(--ok);
	display: grid;
	place-content: center;
	animation: pop 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.done-mark .i {
	width: 26px;
	height: 26px;
	stroke-width: 2.2;
}

@keyframes pop {
	from {
		opacity: 0;
		transform: scale(0.7);
	}
}

.toasts {
	position: fixed;
	z-index: 100000;
	left: 0;
	right: 0;
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 0 16px;
	pointer-events: none;
}

.toast {
	pointer-events: auto;
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: 100%;
	padding: 10px 10px 10px 16px;
	border-radius: 2px;
	background: var(--ink);
	color: var(--on-accent);
	box-shadow: var(--shadow);
	font-weight: 500;
	animation: rise 0.22s ease;
}

.toast button {
	border: 0;
	border-radius: 2px;
	min-height: 32px;
	padding: 0 10px;
	background: transparent;
	color: var(--moved-fill);
	font-weight: 600;
	text-decoration: underline;
}

.toast .i {
	color: var(--ok-fill);
}

.toast-bad .i {
	color: var(--bad-fill);
}

@keyframes rise {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}
