
html:has(body[data-scroll-locked]) {
	overflow: hidden;
	scrollbar-gutter: auto;
}

body[data-scroll-locked] {
	overflow: hidden;
	margin-right: var(--scrollbar_strip);
}

.floating {
	position: fixed;
	left: var(--float_left, 0px);
	top: var(--float_top, 0px);
}

.overlay {
	position: fixed;
	inset: 0;
	z-index: var(--z_overlay);
	background: var(--color-overlay);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.overlay[data-state="open"] {
	animation: fade_in var(--duration_ui) var(--ease_ui);
}

.overlay[data-state="closed"] {
	pointer-events: none;
	animation: fade_out var(--duration_ui) var(--ease_ui) forwards;
}

.dialog_overlay {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	overflow-y: auto;
	padding: 16px;
}

.dialog_overlay:has(.palette) {
	justify-content: flex-start;
	padding-top: 80px;
}

.dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	flex-shrink: 0;
	width: 100%;
	max-width: 440px;
	max-height: calc(100dvh - 2rem);
	overflow: hidden;
	border-radius: 16px;
	background: var(--color-bg-white-0);
	box-shadow: var(--surface_md);
	outline: none;
}

.dialog.palette {
	max-width: 560px;
}

.overlay[data-state="open"] .dialog {
	animation: zoom_in var(--duration_ui) var(--ease_ui);
}

.overlay[data-state="closed"] .dialog {
	animation: zoom_out var(--duration_ui) var(--ease_ui) forwards;
}

.dialog_head {
	display: flex;
	flex-shrink: 0;
	align-items: flex-start;
	gap: 14px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--color-stroke-soft-200);
}

.dialog_text {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.dialog_title {
	color: var(--color-text-strong-950);
	overflow-wrap: anywhere;
	font-size: var(--text-label-sm);
	line-height: var(--text-label-sm--line-height);
	letter-spacing: var(--text-label-sm--letter-spacing);
	font-weight: var(--text-label-sm--font-weight);
}

.dialog_desc {
	color: var(--color-text-sub-600);
	font-size: var(--text-paragraph-xs);
	line-height: var(--text-paragraph-xs--line-height);
	letter-spacing: var(--text-paragraph-xs--letter-spacing);
	font-weight: var(--text-paragraph-xs--font-weight);
}

.dialog_foot {
	display: flex;
	flex-shrink: 0;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-top: 1px solid var(--color-stroke-soft-200);
}

.dialog_foot > * {
	flex: 1;
	min-width: fit-content;
}

.drawer_overlay {
	display: grid;
	place-items: end;
	overflow: hidden;
}

.drawer {
	display: flex;
	flex-direction: column;
	width: calc(100% - 16px);
	max-width: 520px;
	height: calc(100dvh - 16px);
	margin: 8px;
	overflow: hidden;
	border-radius: 20px;
	background: var(--color-bg-white-0);
	box-shadow: var(--surface_md);
	outline: none;
}

.overlay[data-state="open"] .drawer {
	animation: drawer_in var(--duration_drawer_in) var(--ease_pill);
}

.overlay[data-state="closed"] .drawer {
	animation: drawer_out var(--duration_ui) var(--ease_in) forwards;
}

.drawer_head {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 12px;
	padding: 20px 20px 16px;
}

.drawer_title {
	color: var(--color-text-strong-950);
	overflow-wrap: anywhere;
	font-size: var(--text-label-lg);
	line-height: var(--text-label-lg--line-height);
	letter-spacing: var(--text-label-lg--letter-spacing);
	font-weight: var(--text-label-lg--font-weight);
}

.drawer_desc {
	margin-top: 2px;
	color: var(--color-text-sub-600);
	font-size: var(--text-paragraph-sm);
	line-height: var(--text-paragraph-sm--line-height);
	letter-spacing: var(--text-paragraph-sm--letter-spacing);
	font-weight: var(--text-paragraph-sm--font-weight);
}

.drawer_body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 20px;
	min-height: 0;
	padding: 0 10px 20px 20px;
	overflow-y: auto;
	scrollbar-gutter: stable;
}

.popover {
	z-index: var(--z_popover);
	width: max-content;
	max-width: calc(100vw - 24px);
	padding: 20px;
	border-radius: 16px;
	background: var(--color-bg-white-0);
	box-shadow: var(--surface_md);
	outline: none;
}

.popover.flush {
	padding: 0;
}

.menu {
	z-index: var(--z_popover);
	display: flex;
	flex-direction: column;
	gap: 4px;
	width: 240px;
	max-width: calc(100vw - 24px);
	padding: 8px;
	overflow: hidden;
	border-radius: 16px;
	background: var(--color-bg-white-0);
	box-shadow: var(--surface_md);
	outline: none;
}

:is(.popover, .menu)[data-state="open"], :is(.popover, .menu):not([hidden]):not([data-state]) {
	transform-origin: top center;
	animation: pop_in_bottom var(--duration_ui) var(--ease_ui);
}

:is(.popover, .menu)[data-state="open"][data-side="top"] {
	transform-origin: bottom center;
	animation-name: pop_in_top;
}

:is(.popover, .menu)[data-align="end"] {
	transform-origin: top right;
}

:is(.popover, .menu)[data-side="top"][data-align="end"] {
	transform-origin: bottom right;
}

:is(.popover, .menu)[data-state="closed"] {
	pointer-events: none;
	animation: pop_out var(--duration_ui) var(--ease_ui) forwards;
}

.menu_item {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	min-width: 0;
	padding: 8px;
	border-radius: 8px;
	color: var(--color-text-strong-950);
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	user-select: none;
	font-size: var(--text-paragraph-sm);
	line-height: var(--text-paragraph-sm--line-height);
	letter-spacing: var(--text-paragraph-sm--letter-spacing);
	font-weight: var(--text-paragraph-sm--font-weight);
	transition: background-color var(--duration_ui) var(--ease_ui);
}

.menu_item > svg {
	width: 20px;
	min-width: 0;
	height: 20px;
	flex-shrink: 1;
	color: var(--color-text-sub-600);
}

.menu_item:focus, .menu_item[data-highlighted] {
	background: var(--color-bg-weak-50);
	outline: none;
}

@media (hover: hover) and (pointer: fine) {
	.menu_item:not([aria-disabled="true"]):hover {
		background: var(--color-bg-weak-50);
	}
}

html[data-input-mode="keyboard"] .menu_item:focus-visible {
	outline: 2px solid var(--color-primary-base);
	outline-offset: -2px;
}

.menu_item[aria-disabled="true"], .menu_item[aria-disabled="true"] > svg {
	color: var(--color-text-disabled-300);
	cursor: default;
}

.menu_head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 6px 8px;
}

.menu_separator {
	flex-shrink: 0;
	height: 1px;
	margin: 4px -8px;
	background: var(--color-stroke-soft-200);
}

.tooltip {
	position: fixed;
	left: var(--float_left, 0px);
	top: var(--float_top, 0px);
	z-index: var(--z_tooltip);
	max-width: min(320px, calc(100vw - 16px));
	background: var(--color-bg-white-0);
	color: var(--color-text-strong-950);
	box-shadow: 0 0 0 1px var(--color-stroke-soft-200), var(--shadow-tooltip);
	pointer-events: none;
	transform-origin: top center;
}

.tooltip.simple {
	padding: 4px 10px;
	border-radius: 6px;
	font-size: var(--text-paragraph-sm);
	line-height: var(--text-paragraph-sm--line-height);
	letter-spacing: var(--text-paragraph-sm--letter-spacing);
	font-weight: var(--text-paragraph-sm--font-weight);
}

.tooltip.term_tip {
	padding: 8px 12px;
	border-radius: 8px;
	text-align: left;
}

.tooltip[data-side="top"] {
	transform-origin: bottom center;
}

.tooltip[data-state="open"] {
	animation: tip_in_bottom var(--duration_tip) ease;
}

.tooltip[data-state="open"][data-side="top"] {
	animation-name: tip_in_top;
}

.tooltip[data-state="closed"] {
	animation: tip_out var(--duration_tip) ease forwards;
}

.tip_body {
	position: relative;
	display: block;
}

.tip_arrow {
	position: absolute;
	left: var(--arrow_left, calc(50% - 5px));
	top: -5px;
	width: 10px;
	height: 10px;
	border: 1px solid var(--color-stroke-soft-200);
	border-top-left-radius: 3px;
	background: var(--color-bg-white-0);
	clip-path: polygon(0 0, 100% 0, 0 100%);
	transform: rotate(45deg);
}

.tooltip[data-side="top"] .tip_arrow {
	top: auto;
	bottom: -5px;
	transform: rotate(225deg);
}

.tip_title {
	color: var(--color-text-strong-950);
}

.tip_text {
	color: var(--color-text-sub-600);
	white-space: pre-line;
}

.tip_title + .tip_text {
	margin-top: 2px;
}

.tip_how {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 6px;
	margin-top: 8px;
	color: var(--color-text-sub-600);
}

.tip_title + .tip_how {
	margin-top: 4px;
}

.tip_how_value {
	color: var(--color-text-strong-950);
}

.toaster {
	position: fixed;
	right: calc(32px - var(--scrollbar_strip));
	bottom: calc(32px + var(--toast_lift, 0px));
	z-index: var(--z_toast);
	width: 356px;
	pointer-events: none;
}

html:has(body[data-scroll-locked]) .toaster {
	right: 32px;
}

.toast_list {
	position: relative;
	height: var(--front_height, 0px);
}

.toast_item {
	position: absolute;
	right: 0;
	bottom: 0;
	z-index: calc(100 - var(--toast_index, 0));
	width: 100%;
	list-style: none;
	pointer-events: auto;
	outline-offset: 2px;
	transform-origin: bottom center;
	transform: translate(var(--swipe_x, 0px), calc(var(--toast_index, 0) * -14px + var(--swipe_y, 0px))) scale(calc(1 - var(--toast_index, 0) * 0.05));
	transition: transform var(--duration_toast_in) var(--ease_out), opacity var(--duration_toast_in) var(--ease_out);
}

.toast_item::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	height: 14px;
}

.toast_item[data-swiping="true"] {
	transition: none;
}

.toast_item[data-front="false"] .toast {
	height: var(--front_height, auto);
	overflow: hidden;
}

.toast_item[data-front="false"] .toast > * {
	opacity: 0;
}

.toast_list[data-expanded="true"] .toast_item {
	transform: translate(var(--swipe_x, 0px), calc(-1 * var(--toast_offset, 0px) + var(--swipe_y, 0px)));
}

.toast_list[data-expanded="true"] .toast_item[data-front="false"] .toast {
	height: auto;
}

.toast_list[data-expanded="true"] .toast_item[data-front="false"] .toast > * {
	opacity: 1;
}

.toast_item[data-visible="false"] {
	opacity: 0;
	pointer-events: none;
}

.toast_item[data-state="in"] {
	opacity: 0;
	transform: translateY(100%);
	transition: none;
}

.toast_item[data-state="out"] {
	opacity: 0;
	transform: translate(var(--swipe_x, 0px), calc(100% + var(--swipe_y, 0px)));
	transition: transform var(--duration_ui) var(--ease_ui), opacity var(--duration_ui) var(--ease_ui);
}

.toast {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 12px;
	border-radius: 12px;
	background: var(--color-bg-white-0);
	box-shadow: var(--surface_md);
	user-select: none;
}

.toast > * {
	transition: opacity var(--duration_ui) var(--ease_ui);
}

.toast_icon {
	width: 20px;
	height: 20px;
}

.toast.success .toast_icon {
	color: var(--color-success-base);
}

.toast.info .toast_icon {
	color: var(--color-information-base);
}

.toast.error .toast_icon {
	color: var(--color-error-base);
}

.toast_text {
	color: var(--color-text-strong-950);
	overflow-wrap: anywhere;
}

@media (max-width: 600px) {
	.toaster {
		left: 16px;
		right: calc(16px - var(--scrollbar_strip));
		bottom: calc(16px + var(--toast_lift, 0px));
		width: auto;
	}

	html:has(body[data-scroll-locked]) .toaster {
		right: 16px;
	}
}

@keyframes fade_in {
	from {
		opacity: 0;
	}
}

@keyframes fade_out {
	to {
		opacity: 0;
	}
}

@keyframes zoom_in {
	from {
		opacity: 0;
		transform: scale(0.95);
	}
}

@keyframes zoom_out {
	to {
		opacity: 0;
		transform: scale(0.95);
	}
}

@keyframes drawer_in {
	from {
		transform: translateX(calc(100% + 8px));
	}
}

@keyframes drawer_out {
	to {
		transform: translateX(calc(100% + 8px));
	}
}

@keyframes pop_in_bottom {
	from {
		opacity: 0;
		transform: translateY(-8px) scale(0.95);
	}
}

@keyframes pop_in_top {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.95);
	}
}

@keyframes pop_out {
	to {
		opacity: 0;
		transform: scale(0.95);
	}
}

@keyframes tip_in_bottom {
	from {
		opacity: 0;
		transform: translateY(-8px) scale(0.95);
	}
}

@keyframes tip_in_top {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.95);
	}
}

@keyframes tip_out {
	to {
		opacity: 0;
		transform: scale(0.95);
	}
}